question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when running in latest Next.js version with middleware

See original GitHub issue

On Next.js v12, you’ll get this when adding middleware to your app:

`eval` not allowed in Middleware pages/_middleware
error - node_modules/@builder.io/sdk/dist/index.esm.js?b22a (919:0) @ <unknown>
TypeError: Cannot read property 'parse' of null

This points to this line which makes use of serverOnlyRequire. The problem is that that function makes use of eval to detect require and since Next.js doesn’t allow eval in middleware it’ll throw no matter what so I think another non-eval check is needed.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
end0cr1necommented, Aug 6, 2022

Running a hydrogen storefront using vercel’s edge functions

1reaction
teleazizcommented, Sep 9, 2022

This is fixed and released in the latest stable version please use @builder.io/react@2.0.5 to get the fix, thank you for reporting

Read more comments on GitHub >

github_iconTop Results From Across the Web

Advanced Features: Error Handling - Next.js
Handle errors in your Next.js app. ... It is only visible when the development server runs using next dev , npm run dev...
Read more >
Unable to use the middleware feature with React 18 & output ...
To complete my issue, if I use the export const config in the middleware file, I get only the error 500 mentioned upper...
Read more >
Why am I getting this error when using Next.js middleware?
js . Next. js creates a sandbox for the middleware by removing properties of process , while some libraries require it.
Read more >
Next.js Middleware is out of beta - YouTube
Next. js middleware is out of beta and in this video we will go through the breaking changes that you need to be...
Read more >
next-connect - npm
The method routing and middleware layer for Next.js (and many others). Latest version: 0.13.0, last published: 5 months ago. Start using ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found