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

next-urql's ssr doesn't work with Next 12.1.5 #2400

Closed
arcanis opened this issue Apr 15, 2022 · 2 comments
Closed

next-urql's ssr doesn't work with Next 12.1.5 #2400

arcanis opened this issue Apr 15, 2022 · 2 comments
Labels
bug 🐛 Oh no! A bug or unintented behaviour.

Comments

@arcanis
Copy link

arcanis commented Apr 15, 2022

Steps to reproduce

Clone https://github.com/arcanis/next-bug-context-ssr, run yarn && yarn next dev, and open localhost. It will crash. If you run yarn add next@12.1.5-canary.1 before restarting the server, it'll work.

I'm not sure if the actual problem comes from Next having a regression, or next-urql doing something bad, so I figured I should open an issue on both trackers - the Next.js counterpart is vercel/next.js#36198.

Expected behavior

Should work.

Actual behavior

I have some contexts defined inside layout components (using a pattern similar to the one described here), and since this upgrade those contexts are missing in the SSR build, crashing the direct page load (navigating to the page client-side works fine). It's almost as if pages were built without the _app wrapper.

@arcanis arcanis added the bug 🐛 Oh no! A bug or unintented behaviour. label Apr 15, 2022
@pdong
Copy link

pdong commented Apr 15, 2022

I ran into the same issue as you and narrowed it down to a change in canary.1 and canary.2 as well. I was able to get it working by disabling Suspense in urql via the options in withUrqlClient. e.g.

{ ssr: true, neverSuspend: true }

I haven't dug into it too much but it seems like something changed in Next that is causing prepass to maybe not be catching errors anymore? LMK if neverSuspend fixes your issue; it seems to have resolved my inability to access context when doing SSR

@arcanis
Copy link
Author

arcanis commented Apr 16, 2022

The problem seems to have been a regression now fixed in Next; it's not released yet, but I had success building a fresh next package off their main branch and referencing it via a file: dependency.

@arcanis arcanis closed this as completed Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Oh no! A bug or unintented behaviour.
Projects
None yet
Development

No branches or pull requests

2 participants