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:
- A Sentry account and project
- A Cloudflare Workers project
- A Next.js application configured for Cloudflare Workers with OpenNext
- The Sentry SDK installed and configured 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 to get started.
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.
{
"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:
{
"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.
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").