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
Investigating how Floci handles API Gateway REST path-based invocation.
- Assistant
Running tests and checking whether
create-deployment --stage-namecreates a stage. - Assistant
Implementing fixes: data-plane requests without AWS auth default to
us-east-1, but APIs created via CLI in another region are stored under that region — causing the lookup failure. - Assistant
Adding integration tests for the region-mismatch and create-deployment scenarios.
- Assistant
Fixed two issues that caused the
_user_request_path to return{"message":"Invalid API id specified"}.Root cause
The
_user_request_controller was wired correctly, but execute-plane dispatch resolved region from theAuthorizationheader. Management calls via AWS CLI include SigV4 credentials with the CLI region (e.g.eu-west-2), so APIs are stored under that region.Plain
curlhas no auth header, so Floci fell back toFLOCI_DEFAULT_REGION(us-east-1). The lookup then failed with "Invalid API id specified" even though the API existed ineu-west-2.Fixes
-
Cross-region API lookup on the data plane —
ApiGatewayExecuteController.dispatch()now finds the API’s actual region by ID (v1 and v2) before routing, so , , and work without auth headers.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.