Skip to content

fastapi background tasks do not work on azure function apps #33

Description

@warreee

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

I added background tasks as described in https://fastapi.tiangolo.com/tutorial/background-tasks/.
You can see this in my fork of this repo: https://github.com/warreee/fastapi-on-azure-functions-background-tasks.
When running locally or in Azure will see that a response is not returned immediately but only after 5 seconds (the delay set in the background task).

Any log messages given by the failure

Expected/desired behavior

I expect the function app to give an immediate response while still finishing the background task afterwards.

OS and Version?

MacOs Sonoma

Versions

Function runtime: 4.33.2.2
Python: 3.11

Mention any other details that might be useful


Thanks! We'll be in touch soon.

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