Untitled conversation
- User
[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
Same for the v2 service:
- Assistant
Now fix
dispatch()in the execute controller: - Assistant
All 13 pass. Now run the full apigateway/apigatewayv2 suites to check for regressions:
- Assistant
Some failures appeared — I need to determine whether they're pre-existing or caused by my change. Let me check one failure in detail:
- Assistant
Same Lambda-via-Docker pattern. Confirm pre-existing on the clean tree:
- Assistant
Identical failure counts (2 and 9) on the untouched tree — all failures are pre-existing and environmental (Lambda-invoking tests need a Docker socket this sandbox doesn't have). My change introduces no regressions.
Summary
Root cause: Data-plane invocations (
/restapis/{id}/{stage}/_user_request_/...and/execute-api/...) are plain unsigned HTTP requests, soRegionResolver.resolveRegion()finds no SigV4Authorizationheader and falls back to the default region (us-east-1). But APIs are stored under keys, so an API created in (via signed AWS CLI management calls) was never found — threw . Management-plane operations worked because those requests are signed and carry the region.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.