fix: use create_api_app in OrchestrationClient to prevent read-only container failures#20905
fix: use create_api_app in OrchestrationClient to prevent read-only container failures#20905Br1an67 wants to merge 1 commit intoPrefectHQ:mainfrom
Conversation
03a04e6 to
f5c8c29
Compare
src/prefect/server/api/clients.py
Outdated
| # will point it to the the currently running server instance. | ||
| # ephemeral=True skips UI static file creation, which would fail in | ||
| # read-only containers (e.g. rootless/secure deployments). | ||
| api_app = create_app(ephemeral=True) |
There was a problem hiding this comment.
I think a better solution to this issue would be to use create_api_app instead of create_app. That will fix the UI issue and also avoid adding a lifecycle that starts background services when we don't want them.
|
Thanks @desertaxle, that's a much cleaner approach — |
f31b03f to
2c1c421
Compare
|
Reverted back to
|
…ontainer failures OrchestrationClient only needs API routes for in-process ASGI calls. Using create_api_app() instead of create_app() avoids UI static file creation (PermissionError in read-only containers) and background services startup. Also adds error logging for unexpected action failures in the message handler, so they appear in logs instead of silently going to DLQ. Closes PrefectHQ#19317
2c1c421 to
79ce72e
Compare
|
Updated to use |
Closes #19317
Background services (e.g. actions service) use
OrchestrationClient, which previously calledcreate_app(). This triggers UI static directory creation viacreate_ui_static_subpath(), which fails withPermissionErrorin read-only containers (common in rootless/secure deployments). The exception is swallowed, causing automation actions to silently fail and messages to go to DLQ with no error logs.Changes
1. Use
create_api_appfor OrchestrationClient (src/prefect/server/api/clients.py)OrchestrationClientonly needs API routes for in-process ASGI calls. Usingcreate_api_app()instead ofcreate_app()avoids UI creation and background services startup entirely.2. Add error logging for unexpected action failures (
src/prefect/server/events/actions.py)Catch and log unexpected exceptions in the action consumer before re-raising. This provides visibility when actions fail for reasons other than
ActionFailed, instead of messages silently going to DLQ.3. Regression test (
tests/server/api/test_clients.py)Verifies that
OrchestrationClientusescreate_api_app.Checklist
mint.json.