fix: pass request.app (not registry.settings) to capture_karaoke_config

KeyError 'bucket.secure_uploads.region' in the detached karaoke child
on prod. production.ini stores keys with the app. prefix
(app.bucket.secure_uploads.region) and a request hook strips that
prefix into a dict attached as request.app. request.registry.settings
still carries the raw, prefixed keys.

The upload-time and on-demand karaoke call sites were passing
request.registry.settings; capture_karaoke_config expected the
stripped dict. Dev .ini happens to match both layouts which masked
this — prod raised KeyError and the response 502'd.

Switch both call sites to request.app (matches the pattern used by
backfill_karaoke_async and backfill_mirror_async) and document the
expected shape on capture_karaoke_config.
This commit is contained in:
russell@unturf.com 2026-04-16 19:25:48 -04:00
parent a9345bb7ea
commit 7d7d4a371a
3 changed files with 5 additions and 2 deletions

View file

@ -302,6 +302,9 @@ def capture_karaoke_config(shop, app_settings):
grandchild process receives only immutable values no DB reads
required until the final metadata write (after karaoke completes,
minutes later, by which time the parent has long committed).
app_settings: the app-prefix-stripped settings dict i.e. request.app
(NOT request.registry.settings, which keeps the "app." prefix in prod).
"""
if shop.has_primary_s3:
s3_creds = {

View file

@ -465,7 +465,7 @@ def product_edit(request):
file_key=file_key,
extension=ext,
s3_path=product.s3_path,
karaoke_config=capture_karaoke_config(shop, request.registry.settings),
karaoke_config=capture_karaoke_config(shop, request.app),
db_url=str(request.dbsession.get_bind().url),
)

View file

@ -286,7 +286,7 @@ def karaoke_process(request):
file_key=file_key,
extension=extension,
s3_path=product.s3_path,
karaoke_config=capture_karaoke_config(shop, request.registry.settings),
karaoke_config=capture_karaoke_config(shop, request.app),
db_url=str(request.dbsession.get_bind().url),
)
return {"status": "processing"}