---
title: "Next.js on Cloudflare"
description: "Learn how to configure Sentry for your Next.js application deployed on Cloudflare Workers."
url: https://docs.sentry.io/platforms/javascript/guides/cloudflare/frameworks/nextjs/
---

# Next.js on Cloudflare | Sentry for Cloudflare

The Sentry Next.js SDK supports Next.js applications deployed on Cloudflare Workers, but requires additional configuration to run in this environment.

## [Prerequisites](https://docs.sentry.io/platforms/javascript/guides/cloudflare/frameworks/nextjs.md#prerequisites)

Before you begin, make sure you have:

* A Sentry [account](https://sentry.io/signup/) and [project](https://docs.sentry.io/product/projects.md)
* A [Cloudflare Workers project](https://dash.cloudflare.com/workers/overview)
* A Next.js application configured for Cloudflare Workers with [OpenNext](https://opennext.js.org/cloudflare)
* The Sentry SDK [installed and configured](https://docs.sentry.io/platforms/javascript/guides/nextjs.md) in your Next.js application

If you haven't deployed a Next.js app to Cloudflare Workers before, follow Cloudflare's [Next.js deployment guide](https://developers.cloudflare.com/workers/framework-guides/web-apps/nextjs/) to get started.

## [Configure Wrangler](https://docs.sentry.io/platforms/javascript/guides/cloudflare/frameworks/nextjs.md#configure-wrangler)

Once you've set up Sentry in your Next.js application following the [installation guide](https://docs.sentry.io/platforms/javascript/guides/nextjs.md), you'll need to configure [Wrangler](https://developers.cloudflare.com/workers/wrangler/) with the required compatibility settings.

First, add the `nodejs_compat` [compatibility flag](https://developers.cloudflare.com/workers/runtime-apis/nodejs/) to configure the Cloudflare Workers runtime to provide the Node.js APIs required by the Sentry SDK.

```json
{
  "compatibility_flags": ["nodejs_compat"]
}
```

Then, set the [compatibility date](https://developers.cloudflare.com/workers/configuration/compatibility-dates/) to `2025-08-16` or later. This is required to introduce `https.request` to the Cloudflare Workers runtime, which the Sentry SDK needs to send data.

Your final configuration should look like this:

```json
{
  "compatibility_flags": ["nodejs_compat"],
  "compatibility_date": "2025-08-16"
}
```

After adding these settings, build and deploy your Next.js application to Cloudflare Workers. You should start seeing error events, traces, and logs appear in Sentry.
