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

@sentry/nextjs autoInstrumentServerFunctions breaks next.js' font optimization #8320

Closed
3 tasks done
klaasman opened this issue Jun 13, 2023 · 9 comments
Closed
3 tasks done
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Stale Type: Bug

Comments

@klaasman
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

7.54.0

Framework Version

7.54.0

Link to Sentry event

No response

SDK Setup

Sentry.init({
dsn: SENTRY_DSN,
tracesSampleRate: 1.0,
});

Steps to Reproduce

Clone the following repository: https://github.com/klaasman/sentry-nextjs-font-inlining-bug

  1. npm install
  2. npm run build
  3. open ./.next/server/pages/index.html, you will see that the font-loading is inlined (search for @font-face)
  4. now open next.config.js and comment out the autoInstrumentServerFunctions line
  5. npm run build
  6. open ./.next/server/pages/index.html, you will see that the font-loading is not inlined anymore (search for @font-face)

Expected Result

I expected next.js font optimization feature to work.

Actual Result

The autoInstrumentServerFunctions somehow disables next.js' font inlining feature. This setting is turned on by default, in this repository it is turned off in the next.config.js file.

@klaasman klaasman changed the title @sentry/nextjs font inlining bug @sentry/nextjs breaks next.js' font optimization Jun 13, 2023
@klaasman klaasman changed the title @sentry/nextjs breaks next.js' font optimization @sentry/nextjs autoInstrumentServerFunctions breaks next.js' font optimization Jun 13, 2023
@lforst
Copy link
Member

lforst commented Jun 20, 2023

Thanks for writing in! We'll take a look at this!

@lforst lforst added the Package: nextjs Issues related to the Sentry Nextjs SDK label Jun 20, 2023
@klaasman
Copy link
Author

Thanks - you can find more info in the README of the reproduction github repository.

@github-actions
Copy link
Contributor

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@klaasman
Copy link
Author

Go ahead and reset the clock as this isn't resolved yet

@Lms24
Copy link
Member

Lms24 commented Aug 3, 2023

Hi @klaasman thanks for bumping. This is on our backlog, we'll take a look at it.

@lforst
Copy link
Member

lforst commented Aug 3, 2023

I took a look at how Next.js implements this font optimization. It seems like Next.js does static code analysis to build a font a font manifest and the SDK breaks the manifest generation. I believe a fix is not that straight forward so it might take a while until we get to this.

@klaasman
Copy link
Author

klaasman commented Aug 3, 2023

Thanks for diving into it. What parts of the sentry <-> next.js integration will be turned off if I disable sentry's autoInstrumentServerFunctions option? (and maybe any guidance on how to manually implement the missing parts?)

@lforst
Copy link
Member

lforst commented Aug 3, 2023

Thanks for diving into it. What parts of the sentry <-> next.js integration will be turned off if I disable sentry's autoInstrumentServerFunctions option?

@klaasman unfortunately quite a bit. autoInstrumentServerFunctions controls basically all of the serverside instrumentation for errors and performance. Without it you need to instrument all API routes, data fetchers, and server components, by yourself: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#opt-in-to-auto-instrumentation-on-specific-routes

@getsantry
Copy link

getsantry bot commented May 2, 2024

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added the Stale label May 2, 2024
@getsantry getsantry bot closed this as not planned Won't fix, can't repro, duplicate, stale May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Stale Type: Bug
Projects
Archived in project
Archived in project
Development

No branches or pull requests

5 participants