fix(0089): strip API Gateway stage prefix so /v1 routes resolve (+ complete 0089)#102
Merged
Merged
Conversation
The api-handler Lambda was missing AWS_LAMBDA_HTTP_IGNORE_STAGE_IN_PATH, so lambda_http handed axum the path WITH the /production stage prefix and every /v1 route 404'd (health masked it — it is a keyless gateway mock; 0040's tests are all in-process tower::oneshot, never through the gateway). Would have 404'd the entire public API in T2, not just /backfill/status. Add the env var to the api-handler in compute-stack.ts (mirrors BE's api-handler; env-only Compute redeploy). GET /v1/backfill/status now returns 200 + a valid §4.5 BackfillStatus envelope. Also completes + archives task 0089 (deploy ApiGateway + verify the endpoint live) — the M1 AC "backfill/status endpoint live and returning valid progress data" is now satisfied.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug (found deploying 0089)
After deploying
Prices-production-ApiGateway, every/v1route returned 404 with a valid API key —/v1/backfill/status,/v1/assets, all of them — while/healthreturned 200 and a keyless call returned 403.Root cause: the api-handler Lambda was missing
AWS_LAMBDA_HTTP_IGNORE_STAGE_IN_PATH=true, solambda_httphanded axum the path with the API Gateway stage (/production/v1/backfill/status), matching no route → 404 in ~2 ms (no CH call, confirmed in logs).Why it went unnoticed:
/healthis a keyless API Gateway mock (never invokes the Lambda), and 0040's tests are all in-processtower::oneshot— this was the first real gateway invocation. It would have 404'd the entire public API in T2, not just/backfill/status.The fix (config-only, no Rust change)
Add
AWS_LAMBDA_HTTP_IGNORE_STAGE_IN_PATH: 'true'to the api-handlerenvironmentincompute-stack.ts, mirroring BE's api-handler (BE documents the same var incrates/api/src/common/edge_lock.rs). The Compute redeploy was env-only — diff = one added variable onApiHandlerFunction, ledger-processor untouched.Verified live
Also completes + archives task 0089 — the M1 AC "GET /backfill/status endpoint live and returning valid progress data" is now satisfied.
M1 after this
Remaining M1: 0088 (backfill run, paused) + 0082 (worker/MV verification). The read API is now live.