ERROR: Exception in ASGI application
Traceback (most recent call last):
File ".venv/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 409, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
File ".venv/lib/python3.12/site-packages/starlette/applications.py", line 113, in __call__
await self.middleware_stack(scope, receive, send)
File ".venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in __call__
raise exc
File ".venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in __call__
await self.app(scope, receive, _send)
File ".venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File ".venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File ".venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File ".venv/lib/python3.12/site-packages/starlette/routing.py", line 716, in __call__
await self.middleware_stack(scope, receive, send)
File ".venv/lib/python3.12/site-packages/starlette/routing.py", line 736, in app
await route.handle(scope, receive, send)
File ".venv/lib/python3.12/site-packages/starlette/routing.py", line 290, in handle
await self.app(scope, receive, send)
File ".venv/lib/python3.12/site-packages/starlette/routing.py", line 78, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File ".venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File ".venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File ".venv/lib/python3.12/site-packages/starlette/routing.py", line 75, in app
response = await f(request)
^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/fastapi/routing.py", line 302, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/fastapi/routing.py", line 213, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/runpod/serverless/modules/rp_fastapi.py", line 342, in _sim_runsync
{"id": job.id, "status": "COMPLETED", "output": job_output["output"]}
~~~~~~~~~~^^^^^^^^^^
KeyError: 'output'
Describe the bug
When Runpod event handler returns empty object
{},KeyErroris raised withinrunpodframeworkTo Reproduce
Steps to reproduce the behavior:
python worper.py --rp_serve_apicurl -X POST http://localhost:8000/runsync -H "Content-Type: application/json" -d '{"input": {}}'Expected behavior
Either, handler returns empty object as response output or provides clear and concise error message that empty object can't serve as handler output
Runpod SDK version
runpod@1.7.13Screenshots
No screenshots
Desktop (please complete the following information):
SDK issue, not desktop
Smartphone (please complete the following information):
SDK issue, not smartphone
Additional context
The problem arises because FastAPI handler at
runpod-python/runpod/serverless/modules/rp_fastapi.py
Line 342 in 227ef38
job_output['output'], yet that same 'output' gets removed atrunpod-python/runpod/serverless/modules/rp_job.py
Lines 207 to 208 in 227ef38