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
# 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_/helloActual behavior
HTTP 404:
{"message":"Invalid API id specified"}Expected behavior
Request routes through API Gateway to the Lambda function and returns the Lambda response.
Notes
- The API is created successfully (confirmed via get-rest-api and Floci logs)
- The deployment succeeds
- Management plane operations (create/get/update APIs) all work correctly
- Only the data plane invocation path fails
- Tested with Floci 1.5.16
Environment
- Floci 1.5.16 (docker.io/floci/floci:latest)
- Podman 5.8.0 rootless (also likely reproducible with Docker)
- AWS CLI v2
- Region: eu-west-2
Interface
No new interfaces are introduced.
- Assistant
No precedent exists — I'll add cross-region API lookup. Now implementing:
1.
ApiGatewayService— add a finder that locates the region owning an API ID: - Assistant
Clean it up with a proper import:
- Assistant
Now let me check the remainder of the execute controller and the custom-domain filter for other data-plane entry points with the same region problem:
- Assistant
The management-plane
ApiGatewayControlleruses signed requests, so those are fine. Now let me check the existing integration test to add a regression test matching the bug report: - Assistant
Now add the regression test to the integration test file:
- Assistant
Now compile and run the relevant tests:
- Assistant
All 11 pass, including the new cross-region regression tests (API created in
eu-west-2, invoked unsigned). Now run the full API Gateway v1+v2 test suites to check for regressions: - Assistant
Several failures — I need to determine whether these are pre-existing or caused by my change. Let me check against the baseline:
- Assistant
Now verify that everything except the pre-existing broken classes passes with my change:
- Assistant
Two more failing classes — check whether they also fail on baseline:
- Assistant
The fix is complete and verified. Summary:
Root cause
The
_user_request_route was registered and working — the 404"Invalid API id specified"came from region mismatch, not missing routing. The API was created via the AWS CLI, whose SigV4Authorizationheader pins it toeu-west-2in the store (keyedregion::apiId). The data-planecurlinvocation carries no header, so fell back to the default region (), and threw the 404. This affected both and , for REST (v1) and HTTP (v2) APIs alike.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.