Uh oh!
There was an error while loading. Please reload this page.
NextJS SSG Error Handling Not Working, Client-side does #6254
I'm struggling a lot to understand why the server-side error handling isn't working. We have had client side working for quite some time, I'm not sure if server side has ever worked for us (so, I can't point specifically to something we maybe changed as a clue). Versions: I made a testing page that will throw either in when I run it locally with note that comes from the import*asSentryfrom'@sentry/nextjs';constSENTRY_DSN=process.env.SENTRY_DSN||process.env.NEXT_PUBLIC_SENTRY_DSN;Sentry.init({dsn: SENTRY_DSN,environment: process.env.ACTIVE_ENV,tracesSampleRate: 1.0,debug: true,beforeSend: (e)=>{console.log('Sentry: should send');returne;},});Relevant parts of the next config looks like const{ formatInTimeZone }=require('date-fns-tz');const{ withSentryConfig }=require('@sentry/nextjs');constENVIRONMENTS={DEV: 'dev',STAGE: 'staging',PROD: 'production',};constnextjsEnvironment=process.env.ACTIVE_ENV;letENVIRONMENT;if(nextjsEnvironment===ENVIRONMENTS.STAGE){ENVIRONMENT=ENVIRONMENTS.STAGE;}elseif(nextjsEnvironment===ENVIRONMENTS.PROD){ENVIRONMENT=ENVIRONMENTS.PROD;}else{ENVIRONMENT=ENVIRONMENTS.DEV;}constisDev=nextjsEnvironment!==ENVIRONMENTS.STAGE&&nextjsEnvironment!==ENVIRONMENTS.PROD;constisProd=nextjsEnvironment===ENVIRONMENTS.PROD;constSITE_URL=process.env.SITE_URL||process.env.URL||process.env.DEPLOY_URL||'https://oursite';constBRANCH=process.env.VERCEL_GIT_COMMIT_REF||process.env.BRANCH||'unset';constpossibleCommitRef=process.env.VERCEL_GIT_COMMIT_SHA||process.env.COMMIT_REF||'000000';constCOMMIT_REF=possibleCommitRef.slice(0,6);constnow=newDate();constBUILD_DATETIME_HUMAN=formatInTimeZone(now,'America/Chicago',`EEE. MMMM d, yyyy, K:mm aa 'Central'`);constSentryWebpackPluginOptions={silent: false,debug: true,};/** * @type {import('next').NextConfig} */constnextConfig={swcMinify: true,reactStrictMode: true,trailingSlash: false,productionBrowserSourceMaps: true,images: {domains: ['cdn.sanity.io'],// disableStaticImages: true,},// These vars are injected at build time, and are accessible as `process.env.KEY` in site codeenv: {BRANCH: BRANCH,COMMIT_REF: COMMIT_REF,BUILD_DATETIME_HUMAN: BUILD_DATETIME_HUMAN,ACTIVE_ENV: ENVIRONMENT,SITE_URL: SITE_URL,SANITY_PROJECT_ID: process.env.SANITY_PROJECT_ID,SANITY_DATASET: process.env.SANITY_DATASET,SANITY_READ_TOKEN: process.env.SANITY_READ_TOKEN||'',THEMIS_URL: process.env.THEMIS_URL||'https://example.com/graphql',GIT_REF: process.env.COMMIT_REF,SENTRY_DSN: process.env.SENTRY_DSN,FATHOM_SITE_ID: process.env.FATHOM_SITE_ID,MAPBOX_TOKEN: process.env.MAPBOX_TOKEN,ENVIRONMENTS: ENVIRONMENTS,IS_PROD: isProd,},eslint: {// We check in CI, so this is duplicate effort: https://nextjs.org/docs/api-reference/next.config.js/ignoring-eslintignoreDuringBuilds: true,},webpack: (config,options)=>{config.module.rules.push({test: /\.svg$/,use: [options.defaultLoaders.babel,{loader: '@svgr/webpack',options: {babel: false},},],});returnconfig;},};module.exports=withSentryConfig(nextConfig,SentryWebpackPluginOptions); |
Replies: 1 comment
Created #6255 to track this here - let's figure out why this isn't working! |
Created #6255 to track this here - let's figure out why this isn't working!