Next.js on Cloudflare

Learn how to configure Sentry for your Next.js application deployed on Cloudflare Workers.

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

Before you begin, make sure you have:

Once you've set up Sentry in your Next.js application following the installation guide, you'll need to configure Wrangler with the required compatibility settings.

First, add the nodejs_compat compatibility flag to configure the Cloudflare Workers runtime to provide the Node.js APIs required by the Sentry SDK.

Copied
{
  "compatibility_flags": ["nodejs_compat"]
}

Then, set the compatibility date 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:

Copied
{
  "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.

Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").