Hi!
I'm trying to port this code to lambda using lambda web adapter.
@router.post("/node/", response_model=NodeCreateResponse, status_code=201)
async def create_node_endpoint(background_tasks: BackgroundTasks, node_data: NodeInfoPayload = Body(...)):
try:
node =await crud.create_node(node_data.payload)
background_tasks.add_task(crud.create_connections, node)
return JSONResponse(content={"payload":{"id":node.uid,"name":node.name}}, status_code=201)
except HTTPException as e:
raise e
except Exception as e:
return JSONResponse(content={"error": str(e)}, status_code=400)
After the return function the lambda is finished so the background tasks is never executed.
I assume that this not is supported ¿there is any other options without change too much the source code?
Hi!
I'm trying to port this code to lambda using lambda web adapter.
After the return function the lambda is finished so the background tasks is never executed.
I assume that this not is supported ¿there is any other options without change too much the source code?