---
title: "Prisma"
description: "Adds instrumentation for Prisma ORM queries on Cloudflare Workers."
url: https://docs.sentry.io/platforms/javascript/guides/cloudflare/configuration/integrations/prisma/
---

# Prisma for Cloudflare

*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.

The integration relies on Node.js APIs, so your Worker must run with the `nodejs_compat` compatibility flag. Add the `prismaIntegration` to your `instrument.server.ts` file:

```typescript
import * as Sentry from "@sentry/cloudflare";

export default Sentry.defineCloudflareOptions((env) => ({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  tracesSampleRate: 1.0,
  integrations: [Sentry.prismaIntegration()],
}));
```

This integration supports Prisma versions 5, 6, 7, and 8. In Prisma v5, you also need to add the `tracing` preview feature to the `generator` block of your Prisma schema:

```txt
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["tracing"]
}
```

Prisma 8 has no built-in tracing, so the SDK instruments it through diagnostics channels. If channel injection is disabled (`enableRuntimeChannelInjection: false` without build-time injection), no Prisma 8 spans are created. Each ORM call creates a `prisma:client:operation` span with the `pg` query spans nested underneath. `db.sql`, `db.raw`, and `groupBy` calls only create `pg` query spans.

## [Supported Versions](https://docs.sentry.io/platforms/javascript/guides/cloudflare/configuration/integrations/prisma.md#supported-versions)

* `prisma`: `5.x`, `6.x`, `7.x`, `8.x`

## [Learn More](https://docs.sentry.io/platforms/javascript/guides/cloudflare/configuration/integrations/prisma.md#learn-more)

For details on the span structure that Prisma's OpenTelemetry tracing produces in Prisma versions 5 to 7 (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).
