-
Notifications
You must be signed in to change notification settings - Fork 54
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
Need a better way to debug SSR errors #97
Comments
Jake and Ghost will be able to provide more insight into this- but in the meantime, some things that help me:
|
Not sure any of that helps me debug what is going on... More info: If I manually run Currently, it seems that if I amend the code a bit from here: https://github.com/roxiness/spassr/blob/master/src/spassr.js#L37: const foo = await tossr(entrypoint, script, req.url, ssrOptions);
console.log(foo);
return res.send(foo) The value of |
I think I have narrowed this down to the use of Basically, as the DOM is getting torn down, after SSR is complete, an async error is unhandled and this causes node to quit. The async error is in my frontend code, of course, but it's very hard to debug when everything just exits and nothing prints out. The browser is a lot more forgiving of errors like these since it is generally running async code, but Node does not like them. Perhaps there is a way to force unhandled rejections to be just printed out: https://thecodebarbarian.com/unhandled-promise-rejections-in-node.js.html This seems to be a useful clue: https://nodejs.org/api/process.html#process_event_rejectionhandled The built version of the code above also shows part of the error. |
Thanks for looking into this @mizzao. Would you be interested in submitting a PR for this? |
Beat you to it: roxiness/tossr#11. Happy to take any feedback there. |
I'm having a hard time tracking down errors in SSR code right now. For example, if there is a runtime error on the SSR function, both options don't work particularly well:
With
npm run dev:ssr
,tossr
appears to be fine, but has actually actually died and no longer responds to connections. The error does not appear anywhere.with
npm run serve
the error appears but thespassr
just dies, and does not print out the whole error. It is also annoying to debug because it requires a newnpm run build
to try again, which can take a while.Happy to help with improvements to
tossr
,spassr
or anything else to make this work.The text was updated successfully, but these errors were encountered: