Skip to content
TheChatArchiveThe Chat Archive
MiniMaxminimax/minimax-m3· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION [BUG] API Gateway REST: path-based invocation…

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

    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 git reset --hard command. Additionally, you can use git stash and git stash pop 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 submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to 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-$

  2. MiniMax Assistant

    Let me start by exploring the repository structure to understand the codebase.

  3. MiniMax Assistant

    .Let me explore the src directory structure more:

  4. MiniMax Assistant

    Now let me look at the ApiGatewayUserRequestController since the issue is about the data plane invocation path:

  5. MiniMax Assistant

    Now let me look at the ApiGatewayExecuteController to see the dispatch method:

  6. MiniMax Assistant

    Now let me look for the "Invalid API" message in the codebase:

  7. MiniMax Assistant

    Let me look at the v2 getApi method:

  8. MiniMax Assistant

    Let me look at the key structure to understand if region matters:

  9. MiniMax Assistant

    Let me look at the dispatch method more carefully and the resolveRegion method:

  10. MiniMax Assistant

    Let me check the storage backend:

  11. MiniMax Assistant

    Let me look at the CustomDomainFilter:

  12. MiniMax Assistant

    Let me check the existing tests for the user request controller:

  13. MiniMax Assistant

    Now let me look at the proxy match test to understand more:

  14. MiniMax Assistant

    Let me look at the execute controller for context:

  15. MiniMax Assistant

    Let me look at the dispatch method in detail to see how the v1 vs v2 check works:

  16. MiniMax Assistant

    Let me check how to build and run the project:

  17. MiniMax Assistant

    Let me first try to compile and run the existing test:

  18. MiniMax Assistant

    Let me investigate more - the test passes. Let me try the issue with different regions:

  19. MiniMax Assistant

    Now let me try running the test with a different region:

  20. MiniMax Assistant

    Let me look at the resolveRegion method more carefully and see if the issue is region-related:

  21. MiniMax Assistant

    Let me look at the actual implementation more carefully. Let me also check the application.yml:

  22. MiniMax Assistant

    Let me start the dev server and try to reproduce the issue:

  23. MiniMax Assistant

    Let me try without offline mode:

  24. MiniMax Assistant

    It's still downloading. Let me wait longer:

  25. MiniMax Assistant

    The dev mode is stuck waiting for input. Let me kill it and run a different approach - I'll build the project as a JAR and run it as a server:

  26. MiniMax Assistant

    Server is up. Now let me reproduce the issue:

  27. MiniMax Assistant

    Let me install jq:

  28. MiniMax Assistant

    Now let me reproduce the issue:

  29. MiniMax Assistant

    I reproduced the issue. The issue is that the API was created in eu-west-2 region (from the Authorization header), but the curl request has no Authorization header, so the default region us-east-1 is used.

    Let me confirm this is the issue:

  30. MiniMax Assistant

    The issue is confirmed! When the request has no Authorization header, the default region is used (us-east-1) and the API is not found because the API was created in eu-west-2 region. Let me investigate how the system should handle this:

  31. MiniMax Assistant

    Let me see how the existing logic finds APIs:

  32. MiniMax Assistant

    Let me check what apiStore.scan does and see all places where APIs are looked up:

  33. MiniMax Assistant

    Let me look at how the API store can be queried across all regions:

  34. MiniMax Assistant

    Now let me look at the full dispatch method and understand what needs to change:

  35. MiniMax Assistant

    Now let me think about the best approach. The cleanest fix is to add a method to look up the API across all regions:

  36. MiniMax Assistant

    Let me look at the v2 service too:

  37. MiniMax Assistant

    Let me look at how the issue was reported again. The user is using curl without any auth header. The default region is us-east-1 but the API is in eu-west-2. Let me check what existing fallback mechanisms might exist:

  38. MiniMax Assistant

    Now let me design the fix. I'll add a method to find the API across all regions and use it as a fallback:

  39. MiniMax Assistant

    Now let me add a method to find the API across all regions:

  40. MiniMax Assistant

    Now let me look at the existing findApi pattern or similar:

  41. MiniMax Assistant

    Now let me add a method to find API by ID across all regions:

  42. MiniMax Assistant

    Now let me add a method to find the API across all regions:

  43. MiniMax Assistant

    Let me try a different approach - using sed or using the proper format:

  44. MiniMax Assistant

    Now let me add a similar method to the v2 service:

  45. MiniMax Assistant

    Now let me modify the dispatch method to use these new methods:

  46. MiniMax Assistant

    Now let me refactor the dispatch method:

  47. MiniMax Assistant

    Let me revert and start over with a cleaner approach:

  48. MiniMax Assistant

    Now let me write a cleaner patch:

  49. MiniMax Assistant

    Let me check the rest of the dispatchV1:

  50. MiniMax Assistant

    Now let me verify the RestApi class has a getRegion method:

  51. MiniMax Assistant

    Let me check the v1 getRegion usage in my code and fix:

  52. MiniMax Assistant

    Good, my code doesn't use api.getRegion() in v1 since I scan the keys. Let me verify my v1 service code once more:

  53. MiniMax Assistant

    Let me check the v2 Api model:

  54. MiniMax Assistant

    Good. Now let me build the project:

  55. MiniMax Assistant

    Wait, "Nothing to compile" - that means my changes are not being picked up. Let me check:

  56. MiniMax Assistant

    Actually, the compile was successful and the class file is newer than the source. Let me try to compile from scratch:

  57. MiniMax Assistant

    Build succeeded. Now let me run the existing test to make sure it still passes:

  58. MiniMax Assistant

    Now let me kill the running server and restart with the new code:

  59. MiniMax Assistant

    Now let me test the fix:

  60. MiniMax Assistant

    The fix works. Now let me test edge cases:

  61. MiniMax Assistant

    Let me test more edge cases:

  62. MiniMax Assistant

    Let me also test the v2 (HTTP API) case:

  63. MiniMax Assistant

    Let me check why v2 API creation returned null:

  64. MiniMax Assistant

    Let me check the v2 service to understand the integration creation:

  65. MiniMax Assistant

    Wait, my command actually works! Let me look at the actual response. The integration was probably created, but the response was missing. Let me check what was actually returned:

    Actually I see now - my command INT_ID=$(curl -s -X POST ... | jq -r '.IntegrationId') - if the response is "1a6eaef2c8" or whatever, the integration was created. But it shows INT_ID: null. That means the response was empty. Let me check more carefully:

  66. MiniMax Assistant

    The integration IS created. The issue is the INT_ID variable was null because there was a typo or something. The response is {"integrationId":"8db7fbbd",...} and we need to use .integrationId not .IntegrationId. Let me retry:

  67. MiniMax Assistant

    The v2 routeKey is null. Let me check the route creation:

  68. MiniMax Assistant

    The RouteKey field name in the request body might be incorrect. Let me check:

  69. MiniMax Assistant

    The field is routeKey (camelCase) not RouteKey. Let me re-test:

  70. MiniMax Assistant

    Let me check the target field name:

  71. MiniMax Assistant

    Let me set the target via update:

  72. MiniMax Assistant

    Now the v2 case works. Let me also test the v2 case with no auth header:

  73. MiniMax Assistant

    Now let me also run all the API Gateway tests to make sure I didn't break anything:

  74. MiniMax Assistant

    Let me check if these failures are pre-existing by stashing my changes:

  75. MiniMax Assistant

    The 11 test failures are pre-existing. Let me restore my changes:

  76. MiniMax Assistant

    Let me run the specific test for the user request path:

  77. MiniMax Assistant

    Now let me also run a few related tests:

  78. MiniMax Assistant

    Let me also run the v2 tests:

  79. MiniMax Assistant

    Let me also look at the dispatchV2 to make sure my changes don't break anything:

  80. MiniMax Assistant

    Let me also look at the full dispatchV1 to make sure I didn't introduce any issues:

  81. MiniMax Assistant

    Let me check if the storage backend is thread-safe:

  82. MiniMax Assistant

    Now let me also check if there are any other tests that might be affected:

  83. MiniMax Assistant

    Let me look at the final diff:

  84. MiniMax Assistant

    Let me run the build one more time to make sure everything compiles:

  85. MiniMax Assistant

    Let me also do a comprehensive test by running a script:

  86. MiniMax Assistant

    All tests pass. Let me also clean up the test file:

  87. MiniMax Assistant

    Let me also re-run the full set of API Gateway tests:

  88. MiniMax Assistant

    Same 11 pre-existing failures, none caused by my changes. Let me verify by checking which tests fail:

  89. MiniMax Assistant

    Let me check the failing tests to confirm they're not related to my changes:

  90. MiniMax Assistant

    The failing tests require Docker (for Lambda functions), which isn't available in this test environment. These are pre-existing failures.

    Let me also check that the original issue (creating an API with eu-west-2 and invoking with curl) now works:

  91. MiniMax Assistant

    The bug is fixed. Let me clean up and do a final check:

  92. MiniMax Assistant

    Let me also confirm that my fix handles all the checklist items:

    Checklist:

    • [x] If an error was reported in the issue description, I have successfully reproduced it.

      • I reproduced the issue by setting up an API in eu-west-2 region and invoking it with curl (no auth header). The default region is us-east-1, so the API was not found and returned "Invalid API id specified".
    • [x] If an error was reported in the issue description, I have confirmed that my fix resolves the error.

      • After applying the fix, the same scenario returns 200 OK instead of 404. I also tested via both /execute-api/{id}/{stage}/{path} and /restapis/{id}/{stage}/_user_request_/{path} paths.
    • [x] I have thought about edge cases and made sure my fix handles them as well.

      • Edge cases tested:
        • Non-existent API ID → 404 (Invalid API id specified) ✓
        • Non-existent stage → 404 (Not Found) ✓
        • Non-existent path → 404 (Not Found) ✓
        • Wrong method (POST on a GET-only resource) → 405 (Method Not Allowed) ✓
        • API in same region as request → 200 (no change in behavior) ✓
        • API in different region from request → 200 (cross-region fallback) ✓
        • v2 (HTTP API) case also fixed ✓
        • Same region (us-east-1) still works ✓
        • Wrong region auth header (us-east-1 for eu-west-2 API) → 200 (cross-region fallback) ✓
    • [x] I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass.

      • ApiGatewayUserRequestIntegrationTest passes (6/6)
      • ApiGatewayIntegrationTest, ApiGatewayProxyMatchTest, ApiGatewayExecuteControllerTest pass (56/56)
      • All 218 v2 tests pass
      • The 11 failing tests in the full API Gateway test suite are pre-existing failures (require Docker for Lambda containers, not available in this test environment). I verified by stashing my changes and re-running the tests - the same 11 tests fail.

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