Skip to content

PREFECT_LOGFIRE_ENABLED env var check is not properly handling false values #19360

@zzstoatzz

Description

@zzstoatzz

current behavior

in src/prefect/server/database/configurations.py:38, we check:

if os.getenv(PREFECT_LOGFIRE_ENABLED):
    import logfire

this is truthy for ANY string value, including "0" or "false". so setting PREFECT_LOGFIRE_ENABLED=0 still tries to import logfire.

expected behavior

should check explicitly for truthy values:

if os.getenv(PREFECT_LOGFIRE_ENABLED) == "1":
    import logfire

or use proper boolean parsing like pydantic settings does.

impact

this makes it impossible to disable logfire via environment variable override in deployment scenarios where env vars are inherited (e.g., kubernetes helm charts).

discovered while trying to disable logfire for database migrations that inherit PREFECT_LOGFIRE_ENABLED=1 from server config but don't have logfire installed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions