Skip to content

Beta gateway crash-loops: logfire import fails with ModuleNotFoundError (importlib_metadata) in rebuilt Modal images #602

Description

@anth-volk

The #594 merge deploy (run 28671806805) failed all 8 beta integration tests: every gateway endpoint (including /ping) hung past Modal's HTTP window and returned 303 redirects or read timeouts. Production deploy was skipped, so prod is unaffected, but the beta/staging gateway is crash-looping.

Modal logs show the gateway ASGI factory dying at startup:

File "/root/src/modal/logfire_legacy.py", line 43, in configure_logfire
    import logfire
File ".../logfire/version.py", line 3, in <module>
    import importlib_metadata
ModuleNotFoundError: No module named 'importlib_metadata'

Root cause: the Modal images install logfire>=3.0.0 unpinned. #594 changed the images' pip_install layer, invalidating the cached layer, and the fresh rebuild resolved the latest logfire (4.37.0), which imports importlib_metadata unconditionally on Python 3.13 but does not declare it as a dependency (it previously arrived transitively via opentelemetry). The project's uv.lock env (logfire 4.6.0 + importlib-metadata 8.5.0) is unaffected, which is why unit tests and PR CI passed.

Fix: install importlib-metadata>=8 explicitly in both the gateway image and the shared base simulation image.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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