Skip to content

Anthropic message stream events unhandled #17734

Description

@adoxner

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

10.13.0

Framework Version

NodeJS 20.19.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

Sentry.init({
      dsn: Config.SENTRY_DSN,
      integrations: [
        // Add the OpenAI integration
        Sentry.openAIIntegration({
          recordInputs: true,
          recordOutputs: true,
        }),
        Sentry.anthropicAIIntegration({
          recordInputs: true,
          recordOutputs: true,
        })
      ],
      tracesSampleRate: sampleRate,
      profilesSampleRate: sampleRate,
      environment: environmentName
    })

Steps to Reproduce

  1. Install @sentry/node v10.7.0 or later
  2. Initialize Anthropic
  3. Call anthropic.messages.stream() with streaming parameters using .on() event handlers
import Anthropic from '@anthropic-ai/sdk';

const client = new Anthropic();

const stream = await client.messages.stream(streamParams)
          .on('streamEvent', (messageStreamEvent, snapshot) => {
            // Handle streamEvent
          })

Expected Result

Call succeeds and sends message to Anthropic, while listening for streamEvent type.

Actual Result

Error thrown with message:

TypeError: this.anthropic.messages.stream(...).on is not a function

Additional Context

Event handlers (i.e. .on()) are consistent with Anthropic's docs on streaming messages using their Node SDK.

This worked fine in @sentry/node v10.6.0 but has been broken since v10.7.0. It may be related to this PR: #17460

Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Activity

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