ISSUE DESCRIPTION [BUG] API Gateway REST: path-based invocation…
- User
ISSUE DESCRIPTION
[BUG] API Gateway REST: path-based invocation (/restapis/{id}/{stage}/user_request/{path}) returns 404 After creating a REST API, adding a resource with a Lambda proxy integration, and deploying to a stage, invoking via the documented path format returns "Invalid API id specified" (404).
Reproduction
bash# Create Lambda function aws --endpoint-url=http://localhost:4566 lambda create-function \ --function-name test-fn --runtime nodejs22.x --handler index.handler \ --role arn:aws:iam::000000000000:role/r \ --code S3Bucket=...,S3Key=... # Create REST API + resource + integration + deployment API_ID=$(aws --endpoint-url=http://localhost:4566 apigateway create-rest-api --name test | jq -r '.id') ROOT_ID=$(aws --endpoint-url=http://localhost:4566 apigateway get-resources --rest-api-id $API_ID | jq -r '.items[0].id') RES_ID=$(aws --endpoint-url=http://localhost:4566 apigateway create-resource --rest-api-id $API_ID --parent-id $ROOT_ID --path-part hello | jq -r '.id') aws --endpoint-url=http://localhost:4566 apigateway put-method --rest-api-id $API_ID --resource-id $RES_ID --http-method GET --authorization-type NONE aws --endpoint-url=http://localhost:4566 apigateway put-integration --rest-api-id $API_ID --resource-id $RES_ID --http-method GET --type AWS_PROXY --integration-http-method POST --uri "arn:aws:apigateway:eu-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-2:000000000000:function:test-fn/invocations" aws --endpoint-url=http://localhost:4566 apigateway create-deployment --rest-api-id $API_ID --stage-name dev # Invoke via documented path curl http://localhost:4566/restapis/$API_ID/dev/_user_request_/hello - Assistant
I’ll trace the API Gateway REST data-plane routing and request parsing, reproduce the 404 with the existing test/build setup if practical, then implement the smallest routing fix. I’ll run targeted tests and inspect the final diff before submission.
- Assistant
The repository already contains a regression test and controller for this URL, so I’m checking why the route still falls into the management controller. The key distinction is whether Quarkus REST matches the greedy proxy route; the reported “Invalid API id” suggests the user-request resource is not selected at all.
- Assistant
The existing test passes because it uses the emulator’s default
us-east-1. The reproduction creates the API ineu-west-2but invokes with plaincurl, which carries no SigV4 region; the data-plane handler therefore looks only inus-east-1and emits the exact “Invalid API id specified” response. I’ll make REST execution resolve an API ID across stored regions when the request has no usable region, while preserving the normal region-first behavior and error for unknown IDs. - Assistant
The focused
_user_request_integration test still passes, compilation succeeds, and the broader API Gateway suite runs but has 11 pre-existing/state-dependent failures in authorizer tests (the targeted test remains green). The change is limited to REST API execution: it only falls back to the API’s stored region when no Authorization header is present, so signed requests retain region semantics and unknown IDs still return 404. I’m doing one final focused verification and diff review.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.