Skip to content
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

PPR - Static bail out error caught when using partial prerending nextjs #12061

Closed
3 tasks done
andrewdoro opened this issue May 16, 2024 · 4 comments · Fixed by #12194
Closed
3 tasks done

PPR - Static bail out error caught when using partial prerending nextjs #12061

andrewdoro opened this issue May 16, 2024 · 4 comments · Fixed by #12194

Comments

@andrewdoro
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

^8

Framework Version

No response

Link to Sentry event

https://tabtick.sentry.io/issues/369364/events/c792870db01e4425b2076500da9333af/

SDK Setup

sentry.server.config.ts

Sentry.init({
  dsn: process.env.SENTRY_DSN,

  // Adjust this value in production, or use tracesSampler for greater control
  tracesSampleRate: 1,

  // Setting this option to true will print useful information to the console while you're setting up Sentry.
  debug: false,

  // Uncomment the line below to enable Spotlight (https://spotlightjs.com)
  // spotlight: process.env.NODE_ENV === 'development',
  
});

Steps to Reproduce

  • have a next application with ppr enabled
/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    ppr: true,
  },
}
 
module.exports = nextConfig
  • have a request importing next/headers like cookies(), headers()

Expected Result

From next.js docs this is normal, and we shouldn't caught it
https://nextjs.org/docs/messages/ppr-caught-error

Actual Result

Sentry catches errors for routes that use ppr.
This is the error description:

Route /location/les-caves-du-roy-nightclub needs to bail out of prerendering at this point because it used headers. React throws this special object to indicate where. It should not be caught by your own try/catch. Learn more: https://nextjs.org/docs...

Screenshot 2024-05-16 at 10 16 31
@s1gr1d
Copy link
Member

s1gr1d commented May 16, 2024

Hello, can you try to put the content of sentry.server.config.ts into instrumentation.ts? In v8, the Sentry setup on server and edge should be done in instrumentation.ts and the old config files can be deleted.

I just want to make sure that this is not a setup-related problem. I hope this will help :)

Link to the docs

@andrewdoro
Copy link
Author

hey @s1gr1d moved my logic to instrumentation.ts, the error can still be reproduced. I am pretty sure your Node wrapper is catching this error.

import * as Sentry from "@sentry/nextjs";

export async function register() {
  if (process.env.NEXT_RUNTIME === "nodejs") {
    Sentry.init({
      dsn: "https://bf65eb7c9c42794495d4916d58a78477@o4507254924115968.ingest.de.sentry.io/4507254931259472",

      // Adjust this value in production, or use tracesSampler for greater control
      tracesSampleRate: 1,

      // Setting this option to true will print useful information to the console while you're setting up Sentry.
      debug: false,

      // Uncomment the line below to enable Spotlight (https://spotlightjs.com)
      // spotlight: process.env.NODE_ENV === 'development',
    });
  }

  if (process.env.NEXT_RUNTIME === "edge") {
    Sentry.init({
      dsn: "https://bf65eb7c9c42794495d4916d58a78477@o4507254924115968.ingest.de.sentry.io/4507254931259472",

      // Adjust this value in production, or use tracesSampler for greater control
      tracesSampleRate: 1,

      // Setting this option to true will print useful information to the console while you're setting up Sentry.
      debug: false,
    });
  }
}

@andrewdoro
Copy link
Author

Also this should not be caught - from Next.js docs
Screenshot 2024-05-20 at 08 53 16

@AbhiPrasad
Copy link
Member

Fix released with https://github.com/getsentry/sentry-javascript/releases/tag/8.5.0 - please give it a try!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants