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
I’ll trace the REST API data-plane route and its API lookup, then patch it and add a regression test for the documented
/_user_request_/path. - Assistant
rgisn’t installed in this checkout, so I’m using targetedfind/grepsearches. I also found repository-specific guidance inAGENT.mdand am checking that before editing. - Assistant
There is already a regression test, but the route still loses to the management-plane resource matcher at runtime. I’m reproducing that focused test now, then I’ll adjust route specificity based on the actual Quarkus/JAX-RS match.
- Assistant
The failure is region-related, not resource matching: CLI management calls store the API under
eu-west-2, while the unsignedcurlinvocation resolves to Floci’s default region. Since this local URL carries an API ID but no region, I’m making execution resolve the REST API’s stored region (within the current account), while still preferring an explicitly resolved region. - Assistant
The code and test suite compile successfully. The focused test cannot start because the locally cached Maven repository lacks Surefire’s JUnit provider; offline mode correctly avoided fetching it. I’m doing a final code-level check and will use any already-cached compatible test runner if available.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.