This will guide you through setting up Sentry with Next.js and Cloudflare Pages. An example branch with these changes is on GitHub
This will run a wizard to help us set things up the way we need it to. Be sure to update the org/project to match your Sentry project.
pnpx @sentry/wizard@latest -i nextjs --org sentry --project zonr
Select sentry.io, or input your self-hosted Sentry URL (I’m using self-hosted)

Select pnpm as the package manager:

Don’t route requests through Next.js server (this doesn’t seem to work with Pages)

The next few options for things like React annotations/tracing/etc. are up to you. I’ll go ahead and enable them (the default)

Select Yes when prompted to create error page for easy testing

You may get an error that it failed to add .env.sentry-build-plugin to .gitignore - this can be safely ignored if .env* is already in .gitignore

Select Yes when prompted if we’re using CI/CD

Select “I’ll do it later” when prompted to configure CI

Go to https://dash.cloudflare.com and navigate to your Pages project → Settings → Variables and Secrets and add this token so that your builds are able to upload sourcemaps to Sentry

Unfortunately, Sentry won’t work out of the box due to some issues between Next.js 15, @cloudflare/next-on-pages, and @sentry/nextjs. Follow the steps below to get a mostly working Sentry setup.

This is needed due to compatibility issues between next-on-pages and @sentry/next