-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloudflare Pages Next.js - Build failures #14055
Comments
The reason the build is failing is because webpack is unable to resolve |
Thanks @lforst. Haven't modified the webpack in any way. Tried to troubleshoot by removing from the page.tsx, and it compiles, however, does not log anything despite being on the _middleware.js. |
What do you mean by removing from the page.tsx? What setup did you follow? |
You need to make sure that you don't bundle the cloudflare SDK into any clientside code. |
So following https://github.com/getsentry/sentry-javascript/tree/master/packages/cloudflare#readme Install steps are complete. Setup (Cloudflare Pages) is complete, but no activity is being displayed on the Sentry dashboard (including simulated unhandled exceptions). We tried adding the import * as Sentry from '@sentry/cloudflare'; to a client-side page.tsx ('use client') and that was causing the build error. When removed from this page, it builds correctly. Thanks for pointing out it can't be bundled into client-side code. Any tips on why the middleware isn't sending data to Sentry? functions/_middleware.js:
|
I would try adding |
Modifying _middleware.ts to the below does not log anything on the console. This makes me think that the middleware is never being called. import * as Sentry from "@sentry/cloudflare"; export const onRequest = [ |
In https://docs.sentry.io/platforms/javascript/guides/cloudflare/frameworks/ there isn't Next.js mentioned. Can you confirm it is compatible at the moment? |
Compatibility is very experimental. You're basically on your own. CF pages + Next.js is not a priority for us at the moment. |
Got it. Might be a Cloudflare Pages issue if the middleware is not even logging something to the console. Will close for now and open again if required. Thanks, @lforst! |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/cloudflare
SDK Version
8.35.0
Framework Version
Next 14.2.15
Link to Sentry event
No response
Reproduction Example/SDK Setup
import * as Sentry from '@sentry/cloudflare';
export const onRequest = Sentry.sentryPagesPlugin(context => ({
dsn: context.env.SENTRY_DSN,
tracesSampleRate: 1.0,
}));
Steps to Reproduce
Expected Result
npm run deploy would compile successfully and deploy the Pages project to Cloudflare
Actual Result
(Replaced paths with XXXXXX)
The text was updated successfully, but these errors were encountered: