Skip to content

feat: add timeout error handling in Chat#130

Merged
wasaga merged 3 commits intomainfrom
timeout-fix
Jul 11, 2025
Merged

feat: add timeout error handling in Chat#130
wasaga merged 3 commits intomainfrom
timeout-fix

Conversation

@nickytonline
Copy link
Copy Markdown
Member

@nickytonline nickytonline commented Jul 11, 2025

Now if a request times out, the user receives an error message indicating that it might be Pomerium timing out the request.

Note that I set my timeout for the route to five seconds so I could see it error out which is why the error appears that quickly in the GIF.

Testing

Set your chat app route to a low timeout, e.g. 5 seconds like I did. Use a tool like the web search tool. See it timeout after 5 seconds and render the error message.

Closes #127

CleanShot 2025-07-11 at 08 15 56

@netlify
Copy link
Copy Markdown

netlify Bot commented Jul 11, 2025

Deploy Preview for mcp-storybook ready!

Name Link
🔨 Latest commit c4dcc05
🔍 Latest deploy log https://app.netlify.com/projects/mcp-storybook/deploys/68710d0915eff10008da6b19
😎 Deploy Preview https://deploy-preview-130--mcp-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nickytonline nickytonline requested a review from wasaga July 11, 2025 12:39
@nickytonline nickytonline marked this pull request as ready for review July 11, 2025 12:39
@nickytonline nickytonline marked this pull request as draft July 11, 2025 12:40
This commit introduces a new test suite for the streamText function, verifying that it correctly emits a stream_done event when the stream ends. Additionally, a utility function, iterableFromArray, is added to facilitate the creation of async iterables for testing purposes.
@nickytonline nickytonline marked this pull request as ready for review July 11, 2025 13:09
@wasaga wasaga merged commit 6786ac7 into main Jul 11, 2025
6 checks passed
@wasaga wasaga deleted the timeout-fix branch July 11, 2025 13:11
Comment thread src/lib/streaming.test.ts
})
})

describe('streamText', () => {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checking to see that our streamed response always returns a t:{"type":"stream_done"}. We can't add a test for a streamed response that times out as a unit test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

handle timeout disconnect

2 participants