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
Investigating how Floci handles API Gateway REST path-based invocations and why they return 404.
- Assistant
Identifying the issue: data-plane requests resolve region from the Authorization header; plain
curldefaults tous-east-1while the API was created ineu-west-2via AWS CLI. Implementing cross-region API lookup for execute paths and auto-creating stages oncreate-deployment --stage-name. - Assistant
Adding an integration test that reproduces the region-mismatch scenario:
- Assistant
Root cause
The
_user_request_path was reaching the execute controller, but region resolution failed for unauthenticated requests.- Management API calls via AWS CLI include a signed
Authorizationheader with the region (eu-west-2in your repro). - Plain
curlhas no auth header, soRegionResolverfalls back to the default region (us-east-1). - APIs are stored per-region (
eu-west-2::apiId), so the lookup inus-east-1failed with{"message":"Invalid API id specified"}.
A second issue in your repro:
create-deployment --stage-name devwas not creating the stage in Floci (only the deployment), which would have caused a follow-onStage not founderror after fixing the region issue.Fix
-
Cross-region API lookup on the execute plane —
dispatch()now finds REST/HTTP APIs by ID across all regions when the preferred region (from auth or default) does not match. -
create-deploymentwithstageName— REST API deployments now create or update the named stage, matching AWS behavior. -
Regression test —
ApiGatewayUserRequestRegionIntegrationTestcovers creating an API ineu-west-2via signed requests and invoking it via_user_request_without an auth header.
After this fix, your repro should work:
curl http://localhost:4566/restapis/$API_ID/dev/_user_request_/helloThe same fix also applies to
/execute-api/...and/_aws/execute-api/...paths, which had the same region resolution behavior. - Management API calls via AWS CLI include a signed
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
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- fable-5Compare side by side →
- fable-5Compare side by side →