vikejs / vike

🔨 Flexible, lean, community-driven, dependable, fast Vite-based frontend framework.
https://vike.dev
MIT License
4.39k stars 352 forks source link

Stumbled upon a Vike bug. #1852

Closed mean-ui-thread closed 2 months ago

mean-ui-thread commented 2 months ago

Description

3:35:15 p.m. [vike@0.4.193][request(1)][Bug] You stumbled upon a Vike bug. Go to https://github.com/vikejs/vike/issues/new and copy-paste this error. A maintainer will fix the bug (usually under 24 hours).
    at createHttpResponseObject (file:///home/mean-ui-thread/vike-app/node_modules/vike/dist/esm/node/runtime/renderPage/createHttpResponseObject.js:18:13)
    at renderPageAlreadyRouted (file:///home/mean-ui-thread/vike-app/node_modules/vike/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js:65:36)
    at renderPageNominal (file:///home/mean-ui-thread/vike-app/node_modules/vike/dist/esm/node/runtime/renderPage.js:284:36)
    at renderPageAlreadyPrepared (file:///home/mean-ui-thread/vike-app/node_modules/vike/dist/esm/node/runtime/renderPage.js:119:45)
    at renderPageAndPrepare (file:///home/mean-ui-thread/vike-app/node_modules/vike/dist/esm/node/runtime/renderPage.js:99:12)
    at file:///home/mean-ui-thread/vike-app/node_modules/vike/dist/esm/node/plugin/shared/getHttpRequestAsyncStore.js:54:35
    at renderPage (file:///home/mean-ui-thread/vike-app/node_modules/vike/dist/esm/node/runtime/renderPage.js:45:35)
    at file:///home/mean-ui-thread/vike-app/server/express.ts:1:1597
brillout commented 2 months ago

Try again with 0.4.194 and if you get the error again then share the new stack trace. I'll re-open then.

mean-ui-thread commented 2 months ago

Yup, still happening. same exact stack.

mean-ui-thread commented 2 months ago
3:48:58 p.m. [vike@0.4.194][request(2)][Bug] You stumbled upon a Vike bug. Go to https://github.com/vikejs/vike/issues/new and copy-paste this error. A maintainer will fix the bug (usually under 24 hours).
    at createHttpResponse (file:///home/mean-ui-thread/vike-app/node_modules/vike/dist/esm/node/runtime/renderPage/createHttpResponse.js:17:13)
    at renderPageAlreadyRouted (file:///home/mean-ui-thread/vike-app/node_modules/vike/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js:60:32)
    at renderPageNominal (file:///home/mean-ui-thread/vike-app/node_modules/vike/dist/esm/node/runtime/renderPage.js:282:36)
    at renderPageAlreadyPrepared (file:///home/mean-ui-thread/vike-app/node_modules/vike/dist/esm/node/runtime/renderPage.js:116:45)
    at renderPageAndPrepare (file:///home/mean-ui-thread/vike-app/node_modules/vike/dist/esm/node/runtime/renderPage.js:96:12)
    at file:///home/mean-ui-thread/vike-app/node_modules/vike/dist/esm/node/plugin/shared/getHttpRequestAsyncStore.js:54:35
    at renderPage (file:///home/mean-ui-thread/vike-app/node_modules/vike/dist/esm/node/runtime/renderPage.js:43:35)
    at file:///home/mean-ui-thread/vike-app/server/express.ts:1:1597
brillout commented 2 months ago

Inject the following before line 17 of /home/mean-ui-thread/vike-app/node_modules/vike/dist/esm/node/runtime/renderPage/createHttpResponse.js and report back the result.


         if (pageContext.errorWhileRendering) {
+            console.log('pageContext.errorWhileRendering', pageContext.errorWhileRendering);
+            console.log('pageContext._pageId', pageContext._pageId);
             assert(isError);
``
mean-ui-thread commented 2 months ago

no need. that's precisely how I caused this issue. I tried to inject my own error messages during a server-side custom react hook using errorWhileRendering

and that was (obviously) the wrong thing to do :sweat:

mean-ui-thread commented 2 months ago

I originally tried throw Render but it doesn't seem that I can abort a render once it started.

brillout commented 2 months ago

Yea, that's actually what I thought.

As for what you're trying to achieve, feel free to elaborate in a new discussion.