Skip to content

feat(cloudflare): Enable AI v7 support for Cloudflare in the /nodejs_compat entrypoint#21917

Open
JPeer264 wants to merge 2 commits into
jp/oxlint-cloudflarefrom
jp/vercelai-7-cloudflare
Open

feat(cloudflare): Enable AI v7 support for Cloudflare in the /nodejs_compat entrypoint#21917
JPeer264 wants to merge 2 commits into
jp/oxlint-cloudflarefrom
jp/vercelai-7-cloudflare

Conversation

@JPeer264

@JPeer264 JPeer264 commented Jul 2, 2026

Copy link
Copy Markdown
Member

re-implementing #21793 with tests, but in the /nodejs_compat entrypoint. The docs will be updated to clarify that AI v7 would only work in this entrypoint. I didn't want to name the integration differently, as then, the "drop-in replacement" would not work properly.

The majority of the PR is tests, and the actual code implementation is just a copy from the base entrypoint including #21793.

Test info

Unfortunately AI v7 cannot be installed as cloudflare-integration-test dependency, as it requires Node v22. It forced me to add 2 e2e-tests instead.

The test matrix is as follows:

  • Vercel AI v6 with nodejs_als (cloudflare-integration-test)
  • Vercel AI v6 with nodejs_compat (cloudflare-integration-test)
  • Vercel AI v7 with nodejs_als (e2e-test, confirming that it doesn't work)
  • Vercel AI v7 with nodejs_compat (e2e-test)

If v7 support would be added by accident to the base entrypoint, then the Vercel AI v6 with nodejs_als will fail. That should have prevented #21793 to exist actually.

@JPeer264 JPeer264 self-assigned this Jul 2, 2026
@JPeer264 JPeer264 requested a review from a team as a code owner July 2, 2026 11:24
@JPeer264 JPeer264 requested review from andreiborza and mydea and removed request for a team July 2, 2026 11:24
@JPeer264 JPeer264 force-pushed the jp/vercelai-7-cloudflare branch from d6415d8 to 32490ef Compare July 2, 2026 11:42
warnings: [],
}),
}),
prompt: 'How much is the fish?',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Image

@andreiborza andreiborza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice nice nice

@@ -0,0 +1,57 @@
/**
* This is a copy of the Vercel AI integration from the Cloudflare SDK.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This reads a bit confusing, we are in the cloudflare sdk.

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.

Ya, I rephrased that 10 times - was never happy. Maybe I specify the entrypoint

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, I'd specify the tracing path, doesn't have to be the exact path of the integration.

Comment on lines +18 to +28
enableTruncation?: boolean;
}

const _vercelAIIntegration = ((options: VercelAiOptions = {}) => {
const inner = serverUtilsVercelAiIntegration(options);
const instrumentation = cloudflareVercelAIIntegration(options);

return {
...inner,
...instrumentation,
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The VercelAiOptions interface is missing recordInputs and recordOutputs, preventing users from configuring these settings and causing TypeScript compilation errors.
Severity: MEDIUM

Suggested Fix

Update the VercelAiOptions interface in packages/cloudflare/src/nodejs_compat/integrations/tracing/vercelai.ts to include the optional recordInputs?: boolean and recordOutputs?: boolean properties. This will align it with the underlying server-utils integration and allow users to configure these settings directly.

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/nodejs_compat/integrations/tracing/vercelai.ts#L13-L28

Potential issue: The `VercelAiOptions` interface in the new `nodejs_compat` Vercel AI
integration is incomplete. It only exposes the `enableTruncation` option, while omitting
`recordInputs` and `recordOutputs`. This creates a discrepancy with the underlying
`serverUtilsVercelAiIntegration`, which does support these options. As a result, users
attempting to configure input or output recording at the integration level (e.g.,
`vercelAIIntegration({ recordInputs: false })`) will encounter a TypeScript compilation
error. This prevents users from controlling data recording for Vercel AI v7 through the
public API, limiting the integration's configurability.

Did we get this right? 👍 / 👎 to inform future reviews.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 27.59 kB - -
@sentry/browser - with treeshaking flags 26.03 kB - -
@sentry/browser (incl. Tracing) 46.04 kB -0.46% -209 B 🔽
@sentry/browser (incl. Tracing + Span Streaming) 47.77 kB -0.47% -222 B 🔽
@sentry/browser (incl. Tracing, Profiling) 50.81 kB -0.41% -205 B 🔽
@sentry/browser (incl. Tracing, Replay) 85.27 kB -0.27% -224 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.88 kB -0.3% -225 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 89.95 kB -0.26% -232 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 102.62 kB -0.22% -226 B 🔽
@sentry/browser (incl. Feedback) 44.76 kB - -
@sentry/browser (incl. sendFeedback) 32.38 kB - -
@sentry/browser (incl. FeedbackAsync) 37.51 kB - -
@sentry/browser (incl. Metrics) 28.67 kB - -
@sentry/browser (incl. Logs) 28.91 kB - -
@sentry/browser (incl. Metrics & Logs) 29.59 kB - -
@sentry/react 29.38 kB - -
@sentry/react (incl. Tracing) 48.34 kB -0.35% -169 B 🔽
@sentry/vue 32.82 kB -0.63% -207 B 🔽
@sentry/vue (incl. Tracing) 47.9 kB -0.43% -205 B 🔽
@sentry/svelte 27.61 kB - -
CDN Bundle 30 kB - -
CDN Bundle (incl. Tracing) 48.01 kB -0.46% -219 B 🔽
CDN Bundle (incl. Logs, Metrics) 31.57 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.33 kB -0.4% -194 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) 70.77 kB - -
CDN Bundle (incl. Tracing, Replay) 85.48 kB -0.24% -200 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.76 kB -0.24% -204 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 91.3 kB -0.22% -200 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.54 kB -0.24% -222 B 🔽
CDN Bundle - uncompressed 89.35 kB - -
CDN Bundle (incl. Tracing) - uncompressed 145.27 kB -0.45% -649 B 🔽
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.05 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 149.24 kB -0.44% -649 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 218.59 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.28 kB -0.25% -649 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268.24 kB -0.25% -649 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 277.98 kB -0.24% -651 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 281.93 kB -0.24% -651 B 🔽
@sentry/nextjs (client) 50.73 kB -0.43% -218 B 🔽
@sentry/sveltekit (client) 46.43 kB -0.49% -226 B 🔽
@sentry/core/server 77.73 kB -0.71% -552 B 🔽
@sentry/core/browser 64.05 kB -0.88% -563 B 🔽
@sentry/node-core 62.38 kB -1.27% -797 B 🔽
@sentry/node 121.22 kB -1.26% -1.54 kB 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.95 kB - -
@sentry/node/light 50.46 kB -0.46% -233 B 🔽
@sentry/node - without tracing 72.69 kB -2.07% -1.53 kB 🔽
@sentry/aws-serverless 83.57 kB -1.71% -1.45 kB 🔽
@sentry/cloudflare (withSentry) - minified 180.62 kB -0.5% -900 B 🔽
@sentry/cloudflare (withSentry) 446.83 kB -0.52% -2.29 kB 🔽

View base workflow run

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.

2 participants