vercel / speed-insights

Vercel Speed Insights package
https://vercel.com/docs/speed-insights
Apache License 2.0
62 stars 9 forks source link

SpeedInsights import causes breaking changes on pages router #72

Closed ingridkindem closed 5 months ago

ingridkindem commented 5 months ago

Nextjs with pages router.

Versions to reproduce:

    "@vercel/speed-insights": "^1.0.11",
    "next": "14.2.3",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",

When I add the <SpeedInsights /> to _app.tsx, the app breaks. When trying to build the project, I get Generating static pages (0/2) [ ]TypeError: Cannot read properties of null (reading 'entries').

Related issues:

I have tried to work around this with different versions, but not being able to find anything that works. Have deleted my .next folder and rebuilt the project for each install.

Any suggestions for compatible package versions that would make the build pass?

feugy commented 5 months ago

Hello @ingridkindem . I couldn't reproduce the issue with a plain Next.js pages application pinned to the version you shared. However there's only one place where it could fail, so I crafted a fix in @vercel/speed-insights@1.0.12.

Would you mind trying it please?

If it does not fix it, I'll need a reproduction code sandbox like this one.

ingridkindem commented 5 months ago

@feugy Thanks for the quick reply and fix! It fixed the build issue, but unfortunately, I ran into the same issue described here now: https://github.com/vercel/speed-insights/issues/35

feugy commented 5 months ago

@ingridkindem, could you please create a code sandbox for it? I've never managed to reproduce it.