-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Gracefully handle boot file errors in SSR #17658
Comments
I am working the whole week on this problem now. by running const bootFiles = Promise.all([ //no top level await
[...] //not showing all imports
Promise.resolve().then(() => axios$1),
import("./assets/polyfill-BwV_9ARc.mjs"),
import("./assets/sentry-BDCNs69F.mjs")
]).then((bootFiles2) => bootFiles2.map((entry) => entry.default).filter((entry) => typeof entry === "function"));
const serverEntry = (ssrContext) => {
return new Promise(async (resolve, reject) => {
const bootFunctions = await bootFiles; // here is the await and since @quasar/app-vite-v2.0.0-beta.12: const bootFunctions = await Promise.all([ // await is now top level
[...] //not showing all imports
Promise.resolve().then(() => axios$1),
import("./assets/polyfill-BwV_9ARc.mjs"),
import("./assets/sentry-BDCNs69F.mjs")
]).then((bootFiles) => bootFiles.map((entry) => entry.default).filter((entry) => typeof entry === "function"));
const serverEntry = (ssrContext) => {
return new Promise(async (resolve, reject) => {
// directly use awaited bootFunctions from above here You can quickly test if your quasar project is running the build with this command: Reproduction steps with new blank projectSo i wondered if my project maybe have some custom issues. But no, i have node 18+ and set es2022 in quasar.conf.js as browser target, both support top level awaits. I tested if a new quasar project, created by quasar cli, will have node code 13 too.
Try Reverting commit "tweak SSR boot files management" from beta.12I also tried it the other way around in my real project. I changed back the changes made in @quasar/app-vite-v2.0.0-beta.12 for /dist/ssr/server/server-entry.mjs by doing this: const bootFunctionsFix = Promise.all([ // renamed bootFunctions, no more top level await
[...] //not showing all imports
Promise.resolve().then(() => axios$1),
import("./assets/polyfill-BwV_9ARc.mjs"),
import("./assets/sentry-BDCNs69F.mjs")
]).then((bootFiles) => bootFiles.map((entry) => entry.default).filter((entry) => typeof entry === "function"));
const serverEntry = (ssrContext) => {
return new Promise(async (resolve, reject) => {
const bootFunctions = await bootFunctionsFix; // define bootFunction here again with await I put the await back into serverEntry, away from top level and |
server-entry
uses a top-levelawait Promise.all(...)
call. So, if there is a failing boot file, the app silently exits with code 13. Even if you usenode --trace-warnings index.js
, you don't get much useful info because the file consists of a single line for minification reasons.client-entry
template usesPromise.allSettled
to load the boot files, then prints an error in case of an error. So, we should adjust theserver-entry
template to do the same.This can be put in to the app-vite v2 / app-webpack v4, then also be ported back to app-vite v1 / app-webpack v3.
The text was updated successfully, but these errors were encountered: