Skip to content

Bug: app lifespan task ignored when using api_transformer #5236

Closed

Description

@larsblumberg

Describe the bug

app.register_lifespan_task(...) has no effect when using app = App(api_transformer=...)

To Reproduce

from contextlib import asynccontextmanager
from fastapi import FastAPI
from reflex import App

fastapi_app = FastAPI()
app = App(api_transformer=fastapi_app)
# app = App()
app.add_page(lambda: "Hello world", route="/")

@asynccontextmanager
async def app_lifespan():
    print("Inside app_lifespan()")
    yield

app.register_lifespan_task(app_lifespan)

Expected behavior

Lifespan task is started.

Specifics (please complete the following information):

  • Python Version: 3.13
  • Reflex Version: 0.7.9
  • OS: Debian/docker

Activity

  1. masenf commented on May 1, 2025

    @masenf
    Collaborator

    Thanks for reporting this issue. Fix is in progress in #5218, we're hoping to have that out in the 0.7.10a1 pre-release scheduled for today.

  2. added
    bug
    on May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions