Skip to content

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

Closed

Description

@andrewdoro

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

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on May 16, 2024
  2. s1gr1d commented on May 16, 2024

    @s1gr1d
    Member

    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

  3. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on May 16, 2024
  4. andrewdoro commented on May 20, 2024

    @andrewdoro
    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,
        });
      }
    }
  5. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on May 20, 2024
  6. andrewdoro commented on May 20, 2024

    @andrewdoro
    Author

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

  7. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on May 22, 2024
  8. self-assigned this
    on May 23, 2024
  9. AbhiPrasad commented on May 27, 2024

    @AbhiPrasad
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions