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
Now let's add a
findRegionForApimethod in ApiGatewayService and ApiGatewayV2Service, and update the dispatch logic in ApiGatewayExecuteController to fall back to that region when the resolved region doesn't have the API.Assistant
Now let's do the same for ApiGatewayV2Service.
Assistant
I need to add a blank line after line 118 (missing separation).
Assistant
Now let's update the
dispatchmethod in ApiGatewayExecuteController to use the fallback region lookup.Assistant
This looks good. Now let's also check the
ApiGatewayAwsExecuteController.javasince it may have similar dispatch logic for AWS_PROXY execution with the API Gateway "execute" test path.Assistant
Good — that just delegates to the same dispatch method, so the fix covers it automatically. Now let's check
dispatchV2for any additional region-scoped lookups that might need the resolved region we pass in — it should be fine since we passregion.Assistant
That's fine since
regionis passed as parameter directly (not re-resolved). Now let's build and run relevant tests.Assistant
Compiles fine. Now let's run the relevant existing tests plus write a quick manual reproduction test using a temp test class (not saved) or just run via curl against a running dev instance. Let's try running the existing integration tests for apigateway.
Assistant
Test passed (no failures shown, build presumably succeeded). Let's confirm explicit build status and run more related tests including v2 tests.
Assistant
Confirmed pre-existing failures unrelated to my change (Docker unavailable in this environment). Let's restore my changes.
Assistant
Good, my changes are back. Now let's write a quick custom test to specifically simulate the cross-region invocation scenario to confirm the fix works.
Assistant
The test passed (no failure output, "BUILD SUCCESS" implied by clean exit). Let's verify explicitly with test report and remove the temp test file afterward.
Assistant
The test confirms the fix resolves the exact scenario from the issue. Now let's verify it fails without the fix (sanity check), then remove the temp test file.
Assistant
This confirms: without the fix, the reported "Invalid API id specified" 404 reproduces exactly. Now let's restore my fix and remove the temp test file.
Assistant
Temp test file removed, only the 3 intended source files remain modified. Now let's run the full existing test suite for the apigateway package (excluding the pre-existing Docker-dependent failures) to make sure nothing else broke.
Assistant
Identical failure count (22 failures, 41 errors, same tests) confirms these are pre-existing environment-related failures (Docker/Lambda unavailable in this sandbox), not caused by my change. Let's restore the fix.
Assistant
My fix is intact. Let's view the final diff for review.
Assistant
This is a clean, minimal fix. Let's also double check there's no leftover temp file and re-run the specific
ApiGatewayUserRequestIntegrationTestandApiGatewayIntegrationTestone more time to be safe.Assistant
All good, no failures. The temp test file has been removed and everything passes cleanly.
Now let's go through the checklist:
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.