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

Next.js docs for v8.0.0 #12044

Closed
3 tasks done
dorin-flooz opened this issue May 15, 2024 · 4 comments · Fixed by getsentry/sentry-docs#10040
Closed
3 tasks done

Next.js docs for v8.0.0 #12044

dorin-flooz opened this issue May 15, 2024 · 4 comments · Fixed by getsentry/sentry-docs#10040

Comments

@dorin-flooz
Copy link

dorin-flooz commented May 15, 2024

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.0.0

Framework Version

React latest

Link to Sentry event

No response

SDK Setup

No response

Steps to Reproduce

After upgrading to @sentry/nextjs 8.0.0, we get the following message in our yarn next build log:

Creating an optimized production build ...
[@sentry/nextjs] It appears you've configured a `sentry.server.config.ts` file. Please ensure to put this file's content into the `register()` function of a Next.js instrumentation hook instead. To ensure correct functionality of the SDK, `Sentry.init` must be called inside `instrumentation.ts`. Learn more about setting up an instrumentation hook in Next.js: https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation. You can safely delete the `sentry.server.config.ts` file afterward.
[@sentry/nextjs] It appears you've configured a `sentry.edge.config.ts` file. Please ensure to put this file's content into the `register()` function of a Next.js instrumentation hook instead. To ensure correct functionality of the SDK, `Sentry.init` must be called inside `instrumentation.ts`. Learn more about setting up an instrumentation hook in Next.js: https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation. You can safely delete the `sentry.edge.config.ts` file afterward.
[@sentry/nextjs - Node.js] Info: Sending error and performance telemetry data to Sentry. To disable telemetry, set `options.telemetry` to `false`.

We tried following the documentation at https://docs.sentry.io/platforms/javascript/guides/nextjs to fix these issues, but it seems to be out of sync:

Expected Result

  • up to date docs following the release
  • version selector in the docs - without this it's impossible for users to follow version-specific documentation or to even determine if documentation is available for a specific version

Actual Result

...

@mydea mydea changed the title Documentation for v8.0.0 Next.js docs for v8.0.0 May 15, 2024
@HazAT
Copy link
Member

HazAT commented May 15, 2024

Hey, sorry about that - we are jumping on this as we speak.

in the meantime, to unblock you, can you create a file instrumentation.ts and do this:

export async function register() {
  if (process.env.NEXT_RUNTIME === 'nodejs') {
    await import('./sentry.server.config');
  }

  if (process.env.NEXT_RUNTIME === 'edge') {
    await import('./sentry.edge.config');
  }
}

as outlined here
https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#create-initialization-config-files

@s1gr1d
Copy link
Member

s1gr1d commented May 15, 2024

@dorin-flooz Thanks for pointing this out! I updated the docs so they are in line with v8.

I guess the warning won't go away if you import the files like in the snippet @HazAT suggested. You have to delete the server.config and edge.config files. The contents of the files need to be added to the register() function like this:

export async function register() {
  if (process.env.NEXT_RUNTIME === 'nodejs') {
    Sentry.init({
      dsn: env.DSN
      tracesSampleRate: 1.0,
    });
  }

  if (process.env.NEXT_RUNTIME === 'edge') {
    Sentry.init({
      dsn: env.DSN
      tracesSampleRate: 1.0,
    });
  }
}

@dorin-flooz
Copy link
Author

hey @HazAT / @s1gr1d, thanks for the quick reply! What about versioned docs - any plans to have that implemented?
We have postponed the upgrade to 8.0.0 due to the issues above, but if I understand correctly you have now overwritten https://docs.sentry.io/platforms/javascript/guides/nextjs to match the v8.0.0 API - in this case how would we access the v7.00-specific documentation until we upgrade?

@HazAT
Copy link
Member

HazAT commented May 16, 2024

@dorin-flooz we discussed this internally and probably going to work on them
but since this is a bit of a larger project it will take a while but keep an eye out.
Thanks for the feedback!

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.

3 participants