mirror of
https://github.com/jwadow/kiro-gateway.git
synced 2026-04-25 01:15:57 +03:00
[GH-ISSUE #53] BUG: We encountered an issue when using your API key: Streaming error in CURSOR IDE #36
Labels
No labels
bug
bug
enhancement
enhancement
fixed
fixed
invalid
needs-info
needs-testing
pull-request
question
upstream
wontfix
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/kiro-gateway-jwadow#36
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @imrishabhchauhan on GitHub (Jan 23, 2026).
Original GitHub issue: https://github.com/jwadow/kiro-gateway/issues/53
Kiro Gateway Version
v2.1 (latest)
What happened?
@jwadow Got an error saying "{"error":{"type":"provider","reason":"provider_error","message":"Provider returned 504","retryable":true,"provider":{"status":504,"body":"{"detail":"Streaming failed after 3 attempts. Last error: ConnectError"}"}}}" in Cursor chat.
Note: All the Debug Logs are attached. Thanks.
I have done "git pull" already. Everything is configured in Cursor, Kiro Gateway, and Cloudflared.
I sent this message in Cursor chat "Hello this is a message."
Cursor Error Heading: Unable to reach the Model provider - We encountered an issue when using your API key: Streaming error
Kiro Gateway Screenshot:
Cursor Screenshot:
Cloudflared Tunnel Screenshot:

Debug Logs
Debug Logs are attached:
app_logs.txt
error_info.json
kiro_request_body.json
request_body.json
@somehow-paul commented on GitHub (Jan 23, 2026):
It looks like there's an issue with your Kiro authentication.
@jwadow commented on GitHub (Jan 23, 2026):
Hey @imrishabhchauhan!
Looking at your logs, the issue is DNS-related - your system can't resolve the AWS domain name (that's what
[Errno 11001] getaddrinfo failedmeans). This is why both the model list fetch at startup and your actual requests are failing.What's interesting is that you mentioned in discussions that everything worked fine in the Kiro IDE. If that's the case, it's weird that Python is having issues. This could mean different network environment between IDE and Python process, or some proxy/VPN that affects Python but not the IDE.
Quick diagnostic - run this in your Python environment where Kiro Gateway runs:
python -c "import socket; print('DNS test:', socket.gethostbyname('bedrock-runtime.us-east-1.amazonaws.com'))"If that fails, try:
python -c "import socket; print('Internet test:', socket.gethostbyname('google.com'))"If DNS fails:
If DNS works but Kiro still fails, share the output of those tests and check for proxy environment variables (
HTTP_PROXY,HTTPS_PROXY).Let me know what the diagnostic shows!
@imrishabhchauhan commented on GitHub (Jan 23, 2026):
Unfortunately, I tried everything but same issue.
I think maybe Kiro has some restrictions on my region. I live in India.
My Kiro auth token file says:
"authMethod": "IdC",
"provider": "Enterprise",
"region": "ap-south-1"
I tried multiple things step by step:
@imrishabhchauhan commented on GitHub (Feb 8, 2026):
@jwadow I am back to say a huge thanks to you :)
Finally my issue got fixed. My issue was:
Thanks a lot for this amazing project.
Thanks a lot.
@imrishabhchauhan commented on GitHub (Feb 8, 2026):
Hey @jwadow, sorry for tagging again. Sharing a few insights from my experience.
I noticed that now my Kiro Gateway works 100% fine, and I am able to use my Kiro Credits in my Cursor account without any issues. However, I noticed that after 5-10 minutes or more, it starts asking me for authentication. In other words, when I check my Kiro Gateway locks, it says "invalid refresh token" or something like that.
Then I asked ChatGPT about the issue, and ChatGPT told me that I have to manually re-lock into my Kiro ID and then use the new auth token or something like that. I asked ChatGPT to create a GitHub issue, so ChatGPT provided me the below:
TLDR: everything is fine, but after some point Kiro Gateway stops working as intended, and then I have to manually log into Kiro IDE again and then use the new tokens again.
AWS SSO OIDC refresh invalid_grant causes gateway to return 500 and breaks Cursor sessions
Hi, I’m using
kiro-gatewaywith Kiro IDE SSO (AWS IAM Identity Center / SSO OIDC). Intermittently, requests to/v1/chat/completionsfail because the gateway attempts an AWS OIDC refresh and receivesinvalid_grant(“Invalid refresh token provided”). The gateway then returns HTTP 500 to the client (Cursor), which breaks the workflow.Logs (key lines):
https://oidc.us-east-1.amazonaws.com/token400 {"error":"invalid_grant","error_description":"Invalid refresh token provided"}HTTP 500 - POST /v1/chat/completions(Full log attached)
This happens even though Kiro IDE itself continues working (it can re-auth interactively), but the gateway cannot.
Expected behaviour:
invalid_grant, do not return 500. Return 401/503 with a clear message like “Kiro SSO session expired, re-login in Kiro IDE.”/healthso clients can detect degraded auth cleanly.~/.aws/sso/cache/kiro-auth-token.json) and retry once—Kiro IDE may have updated it.Environment:
Attachments attached :)
app_logs.txt
error_info.json
kiro_request_body.json
request_body.json