Skip to content

FastAPI BackgroundTaskExtension does not prevent lambda from closing prematurely #590

@shaybensasson

Description

@shaybensasson

The example fastapi-background-tasks does not print the logs of the Callable the background task is invoking - i.e., the lambda shuts down prematurely.

There are no in mock_task method in logs.

INFO:     Started server process [11]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
in root method 
INFO:     127.0.0.1:36444 - "GET / HTTP/1.1" 200 OK
EXTENSION	Name: lambda-adapter	State: Ready	Events: []
EXTENSION	Name: background-task-extension	State: Ready	Events: [INVOKE]
START RequestId: 67822f07-fe91-4cec-98e9-a66dc904459b Version: $LATEST
in create_task method 
INFO:     147.236.186.62:0 - "POST /tasks HTTP/1.1" 201 Created
END RequestId: 67822f07-fe91-4cec-98e9-a66dc904459b
REPORT RequestId: 67822f07-fe91-4cec-98e9-a66dc904459b	Duration: 47.85 ms	Billed Duration: 1508 ms	Memory Size: 128 MB	Max Memory Used: 86 MB	Init Duration: 1459.74 ms

This might also be a relevant resource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions