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

line must be greater than 0 error happens with ssrFixStacktrace when same error happens the second time #11037

Closed
7 tasks done
sapphi-red opened this issue Nov 22, 2022 · 2 comments · Fixed by #11070
Closed
7 tasks done
Labels
feat: ssr p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@sapphi-red
Copy link
Member

Describe the bug

When a same error happened during rendering in SSR twice, Vite crashes with the following error.

Error: line must be greater than 0 (lines start at line 1)

Reproduction

https://stackblitz.com/edit/github-mxjv5s?file=src%2Ffoo.js

Steps to reproduce

  1. Open reproduction
  2. npm i (will run automatically in stackblitz)
  3. npm run dev (will run automatically in stackblitz)
  4. Open in browser (is already open in stackblitz)
  5. Reload page
  6. Error happens

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
  npmPackages:
    vite: ^3.2.3 => 3.2.4

Used Package Manager

npm

Logs

No response

Validations

@sapphi-red sapphi-red added pending triage p3-minor-bug An edge case that only affects very specific usage (priority) feat: ssr and removed pending triage labels Nov 22, 2022
@sapphi-red
Copy link
Member Author

For the first time, the stacktrace before rewriting is at /src/foo.js:3:20.
For the second time, it's at /src/foo.js:1:20.

Maybe the stacktrace is saved somewhere.

@bluwy
Copy link
Member

bluwy commented Nov 25, 2022

The error is cached here. I think because ssrFixStacktrace mutates the error, the cached error has it's stacktrace already re-written, causing a similar issue to #7045 where ssrFixStacktrace isn't idempotent.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: ssr p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants