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

Issue with WebContainers + Vite + Sveltekit and server errors crashing dev server #1155

Closed
1 task done
paoloricciuti opened this issue Aug 10, 2023 · 4 comments
Closed
1 task done

Comments

@paoloricciuti
Copy link

Describe the bug

Sveltekit + Vite + Webcontainers problem

This issue comes up when there's some server error in sveltekit. Inside the webcontainer the dev server crashes immediately with a cryptic error

Error: `line` must be greater than 0 (lines start at line 1)
    at originalPositionFor$1 (/home/projects/sveltejs-kit-template-default-gncrwp/node_modules/vite/dist/node/chunks/dep-df561101.js:10179:19)
    at eval (/home/projects/sveltejs-kit-template-default-gncrwp/node_modules/vite/dist/node/chunks/dep-df561101.js:55836:25)
    at eval (/home/projects/sveltejs-kit-template-default-gncrwp/node_modules/vite/dist/node/chunks/dep-df561101.js:55827:21)
    at ssrRewriteStacktrace (/home/projects/sveltejs-kit-template-default-gncrwp/node_modules/vite/dist/node/chunks/dep-df561101.js:55826:10)
    at Object.ssrRewriteStacktrace (/home/projects/sveltejs-kit-template-default-gncrwp/node_modules/vite/dist/node/chunks/dep-df561101.js:65063:20)
    at fix_stack_trace (/home/projects/sveltejs-kit-template-default-gncrwp/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:269:23)
    at eval (/home/projects/sveltejs-kit-template-default-gncrwp/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:542:13)

This usually happens when vite calls ssrRewriteStacktrace twice see here

Now, if you start a brand new project locally or even download this stackblitz project you can see that having an error in page.js doesn't crash the dev server while the same things happens if you run it in Webcontainers (it happens on stackblitz and on sveltelab)

Is there something that can be done to prevent this?

Link to the blitz that caused the error

https://stackblitz.com/edit/sveltejs-kit-template-default-gncrwp?file=README.md

Steps to reproduce

  1. Go on https://stackblitz.com/edit/sveltejs-kit-template-default-gncrwp?file=README.md
  2. Wait for the server to load and see it crash

Expected behavior

The dev server should not crash but rather sveltekit should show a 500 page

Parity with Local

Screenshots

No response

Platform

  • OS: macOS
  • Browser: Arc but it should happen in other places too

Additional context

It started happen not so long ago

@Nemikolh
Copy link
Member

Hi @paoloricciuti! 👋

I've opened your blitz and I'm getting a different error:

Internal server error: Parse failure: Unexpected token (6:12)
At file: /src/routes/+page.js
Contents of line 6:     failing here;
      at ssrTransformScript (/home/projects/sveltejs-kit-template-default-gncrwp/node_modules/vite/dist/node/chunks/dep-df561101.js:55395:15)
      at ssrTransform (/home/projects/sveltejs-kit-template-default-gncrwp/node_modules/vite/dist/node/chunks/dep-df561101.js:55370:12)
      at Object.ssrTransform (/home/projects/sveltejs-kit-template-default-gncrwp/node_modules/vite/dist/node/chunks/dep-df561101.js:65044:20)
      at loadAndTransform (/home/projects/sveltejs-kit-template-default-gncrwp/node_modules/vite/dist/node/chunks/dep-df561101.js:55041:24)
      at async instantiateModule (/home/projects/sveltejs-kit-template-default-gncrwp/node_modules/vite/dist/node/chunks/dep-df561101.js:55927:10)

The server does not crash either (I'm in Chrome). I've tried with older version of WebContainer (2 weeks older than this issue) and I get the same thing.

Have you perhaps modified the blitz? Or could this be an issue only in Arc?

@paoloricciuti
Copy link
Author

https://stackblitz.com/edit/sveltejs-kit-template-default-gncrwp?file=README.md

Mmm i swear it gave me the correct error before...btw i've updated it now bu throwing an error inside the load function and now it's back to be the error i reported

@paoloricciuti
Copy link
Author

This seems to have been resolved by this

sveltejs/kit#10769

@eltigerchino
Copy link

eltigerchino commented Oct 27, 2023

It's back :(
https://stackblitz.com/edit/sveltejs-kit-template-default-isgfry?file=src%2Froutes%2F%2Bpage.svelte

Error: `line` must be greater than 0 (lines start at line 1)
    at originalPositionFor$1 (/home/projects/sveltejs-kit-template-default-isgfry/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:10179:19)
    at eval (/home/projects/sveltejs-kit-template-default-isgfry/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:55912:25)
    at eval (/home/projects/sveltejs-kit-template-default-isgfry/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:55903:21)
    at ssrRewriteStacktrace (/home/projects/sveltejs-kit-template-default-isgfry/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:55902:10)
    at ssrFixStacktrace (/home/projects/sveltejs-kit-template-default-isgfry/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:55955:24)
    at Object.ssrFixStacktrace (/home/projects/sveltejs-kit-template-default-isgfry/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:65145:13)
    at fix_stack_trace (/home/projects/sveltejs-kit-template-default-isgfry/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:273:8)
    at eval (/home/projects/sveltejs-kit-template-default-isgfry/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:547:13)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants