honeybadger-js icon indicating copy to clipboard operation
honeybadger-js copied to clipboard

Incompatible with nextjs v15

Open phikes opened this issue 1 year ago • 1 comments

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 avatar Oct 27 '24 10:10 phikes

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

phikes avatar Oct 27 '24 10:10 phikes

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.

phikes avatar Oct 28 '24 13:10 phikes

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.

subzero10 avatar Oct 30 '24 08:10 subzero10

Also experiencing this and have HB turned off on our production frontend as a result 😟

ssyberg avatar Mar 19 '25 17:03 ssyberg

This should have been fixed with #1435.

@phikes and @ssyberg, can you please try with the latest version of @honeybadger-io/nextjs ?

Note: I think you'll have to modify your honeybadger.config.edge.js and honeybadger.config.server.js to import Honeybadger from @honeybadger-io/js:

- import { Honeybadger } from '@honeybadger-io/react'
+ import Honeybadger from '@honeybadger-io/js'

subzero10 avatar May 30 '25 06:05 subzero10

Sorry for taking a while to come back to you, @subzero10 . After finally deploying the update today I can confirm it working.

I have just received my first frontend error through honeybadger again.

phikes avatar Jun 22 '25 18:06 phikes

Awesome, thanks for confirming! As always, don't hesitate to reach out if something else comes up; we'll be happy to help!

subzero10 avatar Jun 24 '25 06:06 subzero10