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 usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /floci, current file: none) bash-$
- Assistant
I'll start by exploring the repository structure and locating the API Gateway REST invocation path handling.
- Assistant
This is a Java/Maven project. I'll search for API Gateway REST path handling and the error message.
- Assistant
Let me search more specifically for apigateway related code.
- Assistant
Let me explore the apigateway service directory and search for the error message.
- Assistant
ApiGatewayUserRequestControllerlooks central — I'll open it and related execute path code. - Assistant
I'll inspect
ApiGatewayExecuteController.dispatchand where "Invalid API id" is thrown. - Assistant
rg is not available. Let me use grep.
- Assistant
Let me read the dispatch method and the getRestApi method, and also search for the error message across the codebase.
- Assistant
The 404 likely comes from a region mismatch on lookup — I'll inspect
getRestApiand region resolution next. - Assistant
I'll inspect RegionResolver and related execute-path tests next.
- Assistant
There's an existing
ApiGatewayUserRequestIntegrationTest— I'll inspect it and check for route conflicts with the management API. - Assistant
I'll check how LocalStack-style cross-region lookup is handled and whether execute-api falls back when the default region misses.
- Assistant
Checking for conflicting routes and how AwsServiceRouter dispatches
/restapisrequests. - Assistant
I'll examine region-lookup helpers and recent API Gateway changes in the changelog and git history.
- Assistant
I'll look for cross-region lookup patterns used elsewhere for execute-style endpoints.
- Assistant
Syntax error due to quotes. Let me fix.
- Assistant
I'll compare path templates on the execute controller and how create-deployment handles stageName.
- Assistant
Checking whether createDeployment auto-creates stages and reviewing AGENT.md for context.
- Assistant
Region mismatch is a strong lead. I'll confirm the default region and how create-deployment treats stageName.
- Assistant
I'll check docs, host-based routing, and whether the request might miss the user-request controller entirely.
- Assistant
I'll confirm AWS create-deployment stageName behavior and look for related OpenAPI/import tests.
- Assistant
Checking response field names — the CLI uses
.itemswhile tests may expect.item. - Assistant
I'll inspect custom-domain resolution and whether related services scan keys across regions.
- Assistant
I'll check the storage backend API, then implement cross-region API lookup and stage creation on deployment.
- Assistant
I'll check how
@Blockingis used on related controllers and confirm the Lambda proxy invocation path. - Assistant
Implementing the fix: adding region resolution helpers and making createDeployment honor stageName.
- Assistant
Implementing walk region lookup helpers and dispatch region resolution.
- Assistant
I'll add
Optionalusage and the helper method next. - Assistant
I'll add Optional import and the findRegion methods, and fix createDeployment.
- Assistant
Navigating to the imports and applying the edit.
- Assistant
I'll apply the edits with a Python script for reliability.
- Assistant
Trying Python or Perl to apply the edits.
- Assistant
I'll use Perl to apply the edits.
- Assistant
Adding the findRegion helper via the editor.
- Assistant
I'll insert the findRegion helper after getRestApi.
- Assistant
Restoring the
getRestApismethod body that the edit removed. - Assistant
I'll fix spacing and update createDeployment; next I'll inspect the Stage model.
- Assistant
Now fix createDeployment.
- Assistant
Replace createDeployment methods.
- Assistant
Adding the v2 region lookup and updating the execute controller's dispatch.
- Assistant
Update v2 service with Optional and findRegion.
- Assistant
Edit imports and getApi area.
- Assistant
Add findRegion method after getApi
- Assistant
I'll remove the duplicate
getApismethod declaration. - Assistant
Updating
ExecuteController.dispatchfor cross-region resolution. - Assistant
I'll replace the dispatch region resolution section.
- Assistant
I'll add
@Blockingto the user-request controller and verify ApiGatewayService's key methods. - Assistant
I'll add Blocking annotations to UserRequest and AwsExecute controllers.
- Assistant
Adding Blocking to AwsExecute as well for consistency.
- Assistant
Verifying the source and running the UserRequest integration test.
- Assistant
I'll confirm whether the tests passed.
- Assistant
Hmm empty output exit 0. Let me try without -q
- Assistant
Writing a temporary test for cross-region invocation and stageName-on-deployment behavior.
- Assistant
The create command left an empty file — I'll write the test content properly.
- Assistant
The temporary cross-region test passed. Removing it and verifying the final diff.
- Assistant
I'll fix the missing trailing newline on
ApiGatewayAwsExecuteController.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →