opennextjs-netlify: Invalid Hook call in dynamic routes

Describe the bug In my next.js website, the dynamic routes, are throwing an error.

image

These work fine locally, and give no errors. This can be related to using of esbuild as node_bundler.

Expected behavior The dynamic routes should work, as they do locally.

Versions

  • Next.js: ^10.2.0
  • plugin (if installed at fixed version):

If you’re using the CLI to build

  • OS: [e.g. macOS, Windows]
  • netlify/cli version:

If you’re using file-based installation

  • netlify.toml: image

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (2 by maintainers)

Most upvoted comments

Hi @kush-daga I managed to reproduce this issue. Removing next from external node modules fixes it for me. Was there a reason you needed to add it? Let me know if it works for you.

yay, thanks for letting us know!!

hmm. i pinged our esbuild expert internally to see what might be up. in the meantime, is it possible to omit one of the three offending features? (aka e-s-t, esbuild, or sentry?) or are all three required for your use case?

note that we will “soon” be moving off of target: serverless to target: server. not in the very near future, but eventually.

and ftr, the NETLIFY_EXPERIMENTAL_PROCESS_DYNAMIC_IMPORTS flag is no longer needed for esbuild to work with dynamic imports!

@kush-daga hey! thanks for reporting this to us! can you please provide a simple and deployable repo that reproduces your issue? it can have just a single failing dynamic page. thank you!

Heyy! Thanks for your reply, I did recreate this issue,

This is the url -> https://romantic-gates-22561a.netlify.app/dynamic/1 GitHub Repo -> https://github.com/kush-daga/next-netlify-bug

Works perfectly on local image