Conversation
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.
Problem
Enterprise AWS IAM Identity Center accounts whose IdC instance lives outside the two Amazon Q Developer profile regions (
us-east-1/eu-central-1) — e.g. an IdC ineu-north-1(Stockholm), start URLhttps://d-XXXX.awsapps.com/start— show no limits on the quota page and return 502 on every chat request.Root cause
The backend used the IdC/OIDC token region (
providerSpecificData.region, e.g.eu-north-1) for every CodeWhisperer runtime call, hittingq.eu-north-1.amazonaws.com— a host that does not exist as a Q Developer runtime endpoint.Per AWS docs, Supported Regions for the Q Developer console and Q Developer profile:
So the Q Developer profile — which produces the
profileArnand hostsgenerateAssistantResponse/GetUsageLimits/ListAvailableModels/ListAvailableProfiles— only exists inus-east-1/eu-central-1, regardless of the IdC region. Aneu-north-1IdC's profile lives ineu-central-1, and its SSO token must be used cross-region against it.Fix
New
open-sse/services/kiroRegion.tsdecouples the two regions:providerSpecificData.regionremains the IdC/OIDC region — used only foroidc.{region}.amazonaws.comtoken mint/refresh.profileArn(resolveKiroRuntimeRegion): profileArn region → a valid stored profile region →us-east-1. A stored IdC region that is not a Q profile region (eu-north-1) is ignored for runtime.discoverKiroProfileArnAcrossRegions) probes the Q profile regions (EU IdC →eu-central-1first) with the cross-region SSO token, instead ofq.{idcRegion}.Wired into:
open-sse/executors/kiro.ts—generateAssistantResponsetargets the profile region (resolveKiroRegionis now profileArn-first;kiroRuntimeHostis re-exported from the shared module).open-sse/services/usage/kiro.ts—getKiroUsageuses multi-region discovery + the profileArn runtime region so Limits resolves.open-sse/services/kiroModels.ts—ListAvailableModelsuses the profileArn runtime region.src/lib/oauth/providers/kiro.ts— login-timepostExchangediscovers theprofileArnacross the profile regions.Same-region setups (
eu-central-1IdC,us-east-1Builder ID) are unchanged, and the SSRF region allowlist (AWS_REGION_PATTERN, GHSA-6mwv-4mrm-5p3m) is preserved.Testing
tests/unit/kiro-idc-cross-region.test.ts(15 cases): runtime-region precedence, profile-region probe order, "never probeq.eu-north-1", loginpostExchange, andgetKiroUsageend-to-end foreu-north-1.