honeybadger-io / honeybadger-js

Universal JavaScript library for reporting errors to Honeybadger.io :zap:
https://www.honeybadger.io/for/javascript/
MIT License
109 stars 62 forks source link

Incompatible with nextjs v15 #1414

Open phikes opened 4 weeks ago

phikes commented 4 weeks ago

What are the steps to reproduce this issue?

  1. Create a project with nextjs version 15
  2. Set up honeybadger for nextjs
  3. Build the application

What happens?

Build fails with:

 ⚠ Invalid next.config.js options detected:
 ⚠     Unrecognized key(s) in object: 'serverComponentsExternalPackages' at "experimental"
 ⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-config
 ⚠ `experimental.serverComponentsExternalPackages` has been moved to `serverExternalPackages`. Please update your next.config.js file accordingly.

What were you expecting to happen?

Build doesn't fail

Any logs, error output, etc?

See above

Any other comments?

This is because of an incorrect version check here. This line checks if the major version is greater than 14 and the minor version is greater than 3 (regardless of the major version). Instead the check should read something like: (+nextJsVersion[0] === 14 && +nextJsVersion[1] >= 3) || +nextJsVersion[0] > 14

What versions are you using?

Operating System:Package Name:Package Version:Browser Version:

phikes commented 4 weeks ago

Fix here: https://github.com/honeybadger-io/honeybadger-js/pull/1415

phikes commented 4 weeks ago

I actually noticed another error: Honeybadger (the react package specifically) imports Component from react. I receive an error now during build stating that react doesn't export Component. When I run the compiled application I get an error because of the missing Component. I have no clue if this is a nextjs bug. I know they do some precompiling of react and other libraries and make it part of the bundle. It seems this issue is related: https://github.com/vercel/next.js/issues/60890. Happens with the same repro above.

subzero10 commented 3 weeks ago

Hey @phikes, thanks for reporting this!

I actually noticed another error: Honeybadger (the react package specifically) imports Component from react. I receive an error now during build stating that react doesn't export Component. When I run the compiled application I get an error because of the missing Component. I have no clue if this is a nextjs bug. I know they do some precompiling of react and other libraries and make it part of the bundle. It seems this issue is related: https://github.com/vercel/next.js/issues/60890. Happens with the same repro above.

I've seen your PR (much appreciated!), I am planning to take another look my self with nextjs v15 as well.