aws / aws/aws-lambda-web-adapter

FastAPI BackgroundTaskExtension does not prevent lambda from closing prematurely

Open
#590 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.7k
Forks
161
Avg merge
2d 10h
Merged PRs (30d)
2

Description

The example [fastapi-background-tasks](https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/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.

```bash
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](https://github.com/awslabs/aws-lambda-web-adapter/discussions/406) might also be a relevant resource.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.