sentry-javascript
sentry-javascript copied to clipboard
Problems with `vercelAiIntegration` for `ai` package on Next.js
There are a few problems with the vercelAiIntegration on Next.js. We made some improvements already (and/or they are pending):
- https://github.com/getsentry/sentry-javascript/pull/16565
- https://github.com/getsentry/sentry-javascript/pull/16566
- https://github.com/getsentry/sentry-javascript/pull/16551
- https://github.com/getsentry/sentry-javascript/pull/16552
Once all of this landed, we've done everything we can do in the SDK itself. That leaves the problem that we cannot monkey-patch ai on Next.js, for whatever reason. This PR may fix this: https://github.com/vercel/ai/pull/6716 in the ai package, but this is still WIP and unclear when/how this lands.
For the time being, once all the linked PRs in the SDK are merged & released, stuff should work, if users manually enable telemetry in every call:
await generateText({
experimental_telemetry: { isEnabled: true },
// ...
});
We should probably inform users in the AI insights module that are using Next.js about this, somehow.