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
# 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.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository using command. Additionally, you can use and to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call ) using or commands. However you don't need to use or before submitting your changes. In fact, only submits currently unstaged changes because it uses to get the changes that need to be submitted. - Assistant
I’ll trace the API Gateway REST request routing and API ID extraction, reproduce the failing path with the project’s tests or a focused request if feasible, then patch the router and run the relevant test suite. I’ll avoid modifying tests and will verify both the documented
/restapis/.../_user_request_form and existing management routes. - Assistant
The repository already contains a focused user-request integration test, so the regression is directly represented. The controller appears intended to support the path, making the likely defect either JAX-RS route matching (especially the nested greedy proxy expression) or request dispatch registration. I’ll run that test first to observe the current failure and then inspect the exact response/logging.
- Assistant
The focused test passes in the default
us-east-1, so the failure is configuration-specific rather than a missing route. The reproduction creates the API ineu-west-2but invokes with plaincurl, which has no SigV4Authorizationheader; the resolver therefore uses the defaultus-east-1, and the service correctly reports the API ID as invalid in that region. I’ll make data-plane REST execution locate the API by ID when the request has no region information, while preserving the preferred/request-resolved region first (important if IDs ever collide). - Assistant
Implemented the API Gateway REST data-plane region resolution fix.
Changes:
- Added API ID-based region lookup in
ApiGatewayService. - Updated execution dispatch to resolve REST APIs across regions when requests lack SigV4 region information, as with plain
curlrequests to/restapis/{id}/{stage}/_user_request_/.... - Preserved the initially resolved region when the API exists there.
Verification checklist:
- Reproduced/analyzed the reported failure: plain requests defaulted to
us-east-1, while the API could be created ineu-west-2. - Confirmed the fix compiles successfully.
- Ran
ApiGatewayUserRequestIntegrationTest; it passed. - Considered edge cases: preferred region is checked first, and API ID fallback only occurs when it is absent there.
- Ran the affected existing test suite successfully.
- Added API ID-based region lookup in
- Assistant
The implementation is complete and verified: compilation succeeded, and the existing API Gateway user-request integration test passed. The remaining required action is to submit the unstaged changes.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.