fix(apigateway): resolve v2 API region across all regions for data-plane dispatch#1906
Open
tirthachetry-zoho wants to merge 2 commits into
Open
Conversation
…ane dispatch Unsigned data-plane requests (browser/frontend) carry no SigV4 Authorization header, so the region resolves to the default (us-east-1). The v2 dispatch detection previously called getApi(region, apiId) with the unresolved region, so a v2 API created in another region (e.g. eu-west-1) was never detected and fell through to v1 handling, failing with 'Invalid API id specified' (404). Resolve the region first via ApiGatewayV2Service.resolveApiRegion (which scans all stored API keys), then check isV2 using the resolved region. Add ApiGatewayV2Service.apiExists(region, apiId) to detect a v2 API that lives in the same/default region. Fixes floci-io#1902
Address PR review feedback on floci-io#1906: - buildV2ProxyEvent hardcoded us-east-1 in requestContext.domainName, so cross-region v2 Lambda invocations (now reachable after the dispatch fix) received a wrong domain. Thread the resolved region through and build the domain as {apiId}.execute-api.{region}.amazonaws.com. - Update the repro test Javadoc, which still described the pre-fix buggy behaviour and contradicted the actual assertions. - Update BuildV2ProxyEventPathParametersTest call sites for the new signature.
Millroy094
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unsigned data-plane requests (browser/frontend) carry no SigV4 Authorization header, so the region resolves to the default (us-east-1). The v2 dispatch detection previously called getApi(region, apiId) with the unresolved region, so a v2 API created in another region (e.g. eu-west-1) was never detected and fell through to v1 handling, failing with
'Invalid API id specified' (404).
Resolve the region first via ApiGatewayV2Service.resolveApiRegion (which scans all stored API keys), then check isV2 using the resolved region. Add ApiGatewayV2Service.apiExists(region, apiId) to detect a v2 API that lives in the same/default region.
Fixes #1902
Summary
Type of change
fix:)feat:)feat!:orfix!:)AWS Compatibility
Checklist
./mvnw testpasses locally