-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
docs(cloudflare): Add new /nodejs_compat entrypoint #18718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| --- | ||
| title: Prisma | ||
| description: "Adds instrumentation for Prisma ORM queries on Cloudflare Workers running with Node.js compatibility." | ||
| --- | ||
|
|
||
| <Alert> | ||
|
|
||
| On Cloudflare, the `prismaIntegration` is only available through the <PlatformLink to="/features/nodejs-compat">`@sentry/cloudflare/nodejs_compat`</PlatformLink> entrypoint, which requires SDK version `10.64.0` or higher. | ||
|
|
||
| </Alert> | ||
|
|
||
| _Import name: `Sentry.prismaIntegration`_ | ||
|
|
||
| Sentry supports tracing [Prisma ORM](https://www.prisma.io/) queries with the Prisma integration. The integration creates a span for each query and reports relevant details to Sentry. | ||
|
|
||
| To enable it on Cloudflare, import Sentry from the `@sentry/cloudflare/nodejs_compat` entrypoint and add the `prismaIntegration` to your `Sentry.init` call: | ||
|
|
||
| ```javascript {3,5} | ||
| import * as Sentry from "@sentry/cloudflare/nodejs_compat"; | ||
|
|
||
| Sentry.init({ | ||
| tracesSampleRate: 1.0, | ||
| integrations: [Sentry.prismaIntegration()], | ||
| }); | ||
| ``` | ||
|
|
||
| This integration supports Prisma versions 5, 6, and 7. In Prisma v5, you also need to add the `tracing` preview feature to the `generator` block of your Prisma schema: | ||
|
|
||
| ```txt {tabTitle: Prisma Schema} {filename: schema.prisma} {3} | ||
| generator client { | ||
| provider = "prisma-client-js" | ||
| previewFeatures = ["tracing"] | ||
| } | ||
| ``` | ||
|
|
||
| ## Supported Versions | ||
|
|
||
| - `prisma`: `5.x`, `6.x`, `7.x` | ||
|
|
||
| ## Learn More | ||
|
|
||
| For details on the span structure that Prisma's OpenTelemetry tracing produces (e.g., `prisma:client:operation`, `prisma:engine:db_query`), see the [Prisma trace output documentation](https://www.prisma.io/docs/orm/prisma-client/observability-and-logging/opentelemetry-tracing#trace-output). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| --- | ||
| title: Node.js Compatibility Entrypoint | ||
| description: "Learn how the nodejs_compat entrypoint unlocks additional Node.js SDK features on Cloudflare Workers, such as Prisma instrumentation." | ||
| --- | ||
|
|
||
| Cloudflare Workers can run with Node.js APIs enabled through the [`nodejs_compat` compatibility flag](https://developers.cloudflare.com/workers/runtime-apis/nodejs/). To take advantage of this, the Cloudflare SDK ships a dedicated `@sentry/cloudflare/nodejs_compat` entrypoint that unlocks Node.js SDK features which aren't available in the default Workers runtime. | ||
|
|
||
| <Alert> | ||
|
|
||
| The `@sentry/cloudflare/nodejs_compat` entrypoint requires SDK version `10.64.0` or higher. It will become the default entrypoint in the next major version (v11). | ||
|
|
||
| </Alert> | ||
|
|
||
| ## What It Unlocks | ||
|
|
||
| The `/nodejs_compat` entrypoint enables Node.js-only integrations and features on Cloudflare, including: | ||
|
|
||
| - The <PlatformLink to="/configuration/integrations/prisma">`prismaIntegration`</PlatformLink> for tracing Prisma ORM queries. | ||
| - Vercel AI SDK v7 support for the <PlatformLink to="/configuration/integrations/vercelai">`vercelAIIntegration`</PlatformLink>. | ||
|
|
||
| ## Usage | ||
|
|
||
| The entrypoint is a drop-in replacement for `@sentry/cloudflare`, so switching over only requires changing your imports: | ||
|
|
||
| ```javascript {tabTitle:After} | ||
| import * as Sentry from "@sentry/cloudflare/nodejs_compat"; | ||
| ``` | ||
|
|
||
| ```javascript {tabTitle:Before} | ||
| import * as Sentry from "@sentry/cloudflare"; | ||
| ``` | ||
|
|
||
| To use the entrypoint, your Worker must set the `nodejs_compat` compatibility flag in your Wrangler configuration: | ||
|
|
||
|
|
||
| ```jsonc {tabTitle:JSON} {filename:wrangler.jsonc} | ||
| { | ||
| "compatibility_flags": ["nodejs_compat"], | ||
| } | ||
| ``` | ||
|
|
||
| ```toml {tabTitle:Toml} {filename:wrangler.toml} | ||
| compatibility_flags = ["nodejs_compat"] | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| ### Integrations | ||
|
|
||
| | | **Auto Enabled** | **Errors** | **Tracing** | **Cron** | **Additional Context** | | ||
| |-----------------------------------------------------|:----------------:|:----------:|:-----------:|:--------:|:----------------------:| | ||
| | --------------------------------------------------- | :--------------: | :--------: | :---------: | :------: | :--------------------: | | ||
| | [`dedupeIntegration`](./dedupe) | ✓ | ✓ | | | | | ||
| | [`fetchIntegration`](./fetchIntegration) | ✓ | ✓ | ✓ | | | | ||
| | [`functionToStringIntegration`](./functiontostring) | ✓ | | | | | | ||
|
|
@@ -13,4 +13,7 @@ | |
| | [`rewriteFramesIntegration`](./rewriteframes) | | ✓ | | | | | ||
| | [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | | | ||
| | [`instrumentPostgresJsSql`](./postgresjs) | | | ✓ | | | | ||
| | [`prismaIntegration`](./prisma) | | | ✓ | | | | ||
| | [`honoIntegration`](./hono) | ✓ | ✓ | | | | | ||
|
|
||
| The [`prismaIntegration`](./prisma) is only available through the [`@sentry/cloudflare/nodejs_compat`](../../features/nodejs-compat) entrypoint. | ||
|
Comment on lines
+18
to
+19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The relative link Suggested FixReplace the relative markdown link Prompt for AI Agent |
||
Uh oh!
There was an error while loading. Please reload this page.