Skip to content
TheChatArchiveThe Chat Archive
composer-2.5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

Untitled conversation

  1. 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_/hello
    

    Actual 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.

  2. Assistant

    Investigating how Floci handles API Gateway REST path-based invocations (/restapis/{id}/{stage}/_user_request_/{path}).

  3. Assistant

    Running the integration test and reproducing the reported scenario.

  4. Assistant

    Identifying two issues: execute-plane requests without AWS auth default to us-east-1 while APIs created in eu-west-2 are stored under that region, and create-deployment --stage-name doesn't auto-create the stage. Implementing fixes.

  5. Assistant

    Adding tests for the fixes:

  6. Assistant

    Fixed the _user_request_ 404. Two separate issues were causing it.

    Root causes

    1. Region mismatch on the data plane — Management calls via AWS CLI include a SigV4 Authorization header (region eu-west-2), so APIs are stored under eu-west-2::apiId. Plain curl has no auth header, so execute dispatch defaulted to us-east-1 and getRestApi returned {"message":"Invalid API id specified"}.

    2. create-deployment --stage-name didn't create a stage — AWS CLI sends stageName in the deployment body. Floci ignored it, so the stage was never created when using the documented one-step deploy flow.

    Fixes

    ApiGatewayExecuteController — Added cross-region API lookup for execute-plane requests when the preferred region has no match:

        /**
         * Resolves the storage region for an execute-api request. Plain HTTP clients
         * (curl, browser) do not send SigV4 Authorization headers, so we fall back to
         * a cross-region lookup by api id when the preferred region has no match.
         */
        private String resolveExecuteRegion(String apiId, String preferredRegion) {
            if (apiGatewayV2Service.hasApi(preferredRegion, apiId)
                    || apiGatewayService.hasRestApi(preferredRegion, apiId)) {
                return preferredRegion;
            }
            return apiGatewayV2Service.findRegionForApi(apiId)
                    .or(() -> apiGatewayService.findRegionForRestApi(apiId))
                    .orElse(preferredRegion);
        }
    

    ApiGatewayService.createDeployment — When stageName is present in the request body, create or update the stage (matching AWS CreateDeployment behavior).

    Tests — Added executeViaUserRequestPathInNonDefaultRegionWithoutAuth covering the exact reproduction: API created in eu-west-2, deployed with stageName: dev, invoked via curl without auth.

    After this fix, your reproduction should work:

    curl http://localhost:4566/restapis/$API_ID/dev/_user_request_/hello
    

    The same region resolution applies to /execute-api/... and /_aws/execute-api/... paths as well.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.