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

Middleware not being built if honeybadger.edge.config.js file is not present #1348

Closed
sayoojtmc opened this issue May 10, 2024 · 3 comments · Fixed by #1356
Closed

Middleware not being built if honeybadger.edge.config.js file is not present #1348

sayoojtmc opened this issue May 10, 2024 · 3 comments · Fixed by #1356
Assignees
Labels
nextjs @honeybadger-io/nextjs

Comments

@sayoojtmc
Copy link

What are the steps to reproduce this issue?

  1. Create a Next.js app with page router
  2. Add a basic middleware.js file
  3. Setup honeybadger without the honeybadger.edge.config.js file
  4. Run yarn build

What happens?

middleware.js is not being shown in the build output. Middleware code does not execute when I run yarn start.

What were you expecting to happen?

middleware.js file to be shown in the build output

Any logs, error output, etc?

None.

Any other comments?

I've debugged the issue, there seems to be a bug in injectHoneybadgerConfigToEntry when handling the case where config file is not present:

if (!hbConfigFile) {
return originalEntry
}

When I changed it to this:

if (!hbConfigFile) {
    const result =
      typeof originalEntry === "function"
        ? await originalEntry()
        : { ...originalEntry };

    return result;
  }

the middleware is getting built.

What versions are you using?

Operating System: MacOS 14.4
Package Name: Next.js 13.4 with page router

@subzero10
Copy link
Member

Hey @sayoojtmc, thanks for reporting an issue! We'll take a look and come back to you.

@subzero10 subzero10 self-assigned this May 11, 2024
@subzero10 subzero10 added the nextjs @honeybadger-io/nextjs label May 19, 2024
@sayoojtmc
Copy link
Author

Hey @subzero10 , any update on this? I'd be happy to raise a PR for this.

@subzero10
Copy link
Member

Hey @sayoojtmc, I just submitted this PR, which is identical to your fix. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nextjs @honeybadger-io/nextjs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants