Skip to content

RR7 + AI SDK + Sentry, consumed stream by Sentry leads to AI SDK failure result.consumeStream is not a function #17593

Closed

Description

@w00fz

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/react-router

SDK Version

10.11.0

Framework Version

React 19.1.1, React Router Framework 7.8.2, AI SDK 5.0.39

Link to Sentry event

No response

Reproduction Example/SDK Setup

https://github.com/w00fz/rr7_aisdk_sentry

Steps to Reproduce

  1. Clone the repository

  2. Create a .env file in the root with your OpenAI API and Sentry DSN keys:

    OPENAI_API_KEY=sk-...
    SENTRY_DSN=https://...
  3. Install dependencies with npm install

  4. Run the development server with npm run dev and verify everything works as expected. Simple chat input should stream back responses from the AI.

  5. Build the production version with npm run build

  6. Start the production server with NODE_ENV=production PORT=5173 npm run start

  7. Open the app in the browser and try to use the chat input again. You should see the error messages mentioned above.

    Example error message from stream

    data: {"type":"start","messageId":"34d1d9d5-74fc-4913-ac03-e9b7f8485faa"}
    data: {"type":"error","errorText":"result.consumeStream is not a function"}
    data: [DONE]
    

Change the start command removing the instrumentation and you will see it working as expected.

Expected Result

Stream is captured by the telemetry, visible in Sentry and AI SDK continues streaming back to the client.

Actual Result

Stream is captured by Sentry but appears to be entirely consumed, leading to undesired errors. The error is then streamed back to the client:

  • result.consumeStream is not a function
  • result.toUIMessageStream is not a function

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Sep 11, 2025
  2. s1gr1d commented on Sep 11, 2025

    @s1gr1d
    Member

    Thanks for the reproduction, we're having a look at it :)

  3. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Sep 11, 2025
  4. RulaKhaled commented on Sep 11, 2025

    @RulaKhaled
    Collaborator

    Hello, this should be fixed with #17580

  5. w00fz commented on Sep 11, 2025

    @w00fz
    Author

    Thank you that's awesome! I was able to test your fix and looks like it's all working as expected now. Appreciate the fast response.

    Cheers.

  6. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions