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

Getting run-time error for new next.js page file, but others work #5704

Closed
3 tasks done
kylemh opened this issue Apr 27, 2021 · 2 comments
Closed
3 tasks done

Getting run-time error for new next.js page file, but others work #5704

kylemh opened this issue Apr 27, 2021 · 2 comments
Labels

Comments

@kylemh
Copy link

kylemh commented Apr 27, 2021

🐛 bug report

Preflight Checklist

  • I have read the
    Contributing Guidelines
    for this project.
  • I agree to follow the
    Code of Conduct
    that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want
    to file, without success.

Description of the problem

I forked a code sandbox. The existing Next.js page file routes work well, but a new one I'm trying to create seems to fail to transpile.

How has this issue affected you? What are you trying to accomplish?

Just trying to create a repro for another bug in another library.

To Reproduce

Go to / page and see no issue.
Go to /login page see the following run-time error: TypeError: Object(...) is not a function

Link to sandbox: link

@smhutch
Copy link
Contributor

smhutch commented May 17, 2021

Thanks for reporting @kylemh. This is certainly an issue.

While testing I found that:

  • The runtime error occurs because useRouter is undefined
  • This is not a code problem, cloning the project and running locally it works fine

@DeMoorJasper is this something you can help out with? I wonder if this could be related to #5632

@DeMoorJasper
Copy link
Member

DeMoorJasper commented May 18, 2021

I don't think this is a codesandbox issue, might just be an incompatible node_module that lives in node_modules of the sandbox but doesn't get downloaded? Or maybe even next.js cache? There should be no difference between this and local as it's a docker container without any custom logic from us

To fix it I changed the dependency to "next": "10.2.0" and restarted the sandbox which causes a reinstall of node_modules and restart of the server. Not entirely sure how this all works internally, I think @lbogdan implemented most of the container sandbox logic.

The other issue you linked is a sandpack issue and will fix that one.

@kylemh kylemh closed this as completed May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants