feat(cloudflare)!: Make the nodejs_compat entrypoint the default - #22900
feat(cloudflare)!: Make the nodejs_compat entrypoint the default#22900JPeer264 wants to merge 1 commit into
Conversation
7397a23 to
6397b2e
Compare
6397b2e to
8631715
Compare
| import { vercelAiIntegration, type VercelAiOptions } from '@sentry/server-utils'; | ||
|
|
||
| const _vercelAIIntegration = ((options: VercelAiOptions = {}) => { | ||
| return { | ||
| name: INTEGRATION_NAME, | ||
| const inner = vercelAiIntegration(options); | ||
|
|
||
| return extendIntegration(inner, { | ||
| options, | ||
| setup(client) { | ||
| addVercelAiProcessors(client); | ||
| }, | ||
| }; | ||
| }); |
There was a problem hiding this comment.
Bug: Importing vercelAIIntegration from the main entrypoint will cause a startup crash in Cloudflare Workers environments that do not have the nodejs_compat flag enabled.
Severity: HIGH
Suggested Fix
Revert the change that exports vercelAIIntegration from the main entrypoint (packages/cloudflare/src/index.ts). This integration and its Node.js-specific dependencies should be isolated in a separate entrypoint, such as the previously used @sentry/cloudflare/nodejs_compat, to prevent breaking users on runtimes without Node.js compatibility.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: packages/cloudflare/src/integrations/tracing/vercelai.ts#L13-L23
Potential issue: The `vercelAIIntegration` is now exported from the main
`@sentry/cloudflare` package entrypoint. This integration depends on
`@sentry/server-utils`, which imports the Node.js-specific module
`node:diagnostics_channel` at the top level. Consequently, any user attempting to import
`vercelAIIntegration` in a Cloudflare Worker environment without the `nodejs_compat`
compatibility flag will experience a startup failure. The worker will fail to load
because it cannot resolve the `node:` module, which is a known constraint for certain
runtimes like Shopify Oxygen. This change violates an explicit architectural rule
designed to keep the main package entrypoint free of Node.js dependencies.
Also affects:
packages/cloudflare/src/index.ts:132
Did we get this right? 👍 / 👎 to inform future reviews.
size-limit report 📦
|
8631715 to
dcac51d
Compare
dcac51d to
0a6bcec
Compare
This PR moves the capabilities of the
/nodejs_compatentrypoint to the default entrypoint and removes the entrypoint entirely.On top I removed all
alsspecific tests, as they're not relevant anymore.