-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
Milestone
Description
Describe the bug
When the first line of a server-side endpoint contains an error, the dev server displays TypeError: Line must be greater than or equal to 1, got -1 instead of showing the actual error.
Reproduction
Create a svelte-kit project and paste this in src/routes/server-side.js
/** @type {import('@sveltejs/kit').RequestHandler} */
export async function get({ params }) {
return {
body: "Hello world"
};
}then start the dev server, load http://localhost:3000/server-route in your browser
Then add a line at the top of the file, containing thisvariableisnotdefined, so as to get
thisvariableisnotdefined
/** @type {import('@sveltejs/kit').RequestHandler} */
export async function get({ params }) {
return {
body: "Hello world"
};
}Logs
TypeError: Line must be greater than or equal to 1, got -1
at BasicSourceMapConsumer.SourceMapConsumer_findMapping [as _findMapping] (/tmp/bug3118/node_modules/vite/dist/node/chunks/dep-76613303.js:58876:13)
at BasicSourceMapConsumer.SourceMapConsumer_originalPositionFor [as originalPositionFor] (/tmp/bug3118/node_modules/vite/dist/node/chunks/dep-76613303.js:58945:22)
at /tmp/bug3118/node_modules/vite/dist/node/chunks/dep-76613303.js:59886:34
at String.replace (<anonymous>)
at /tmp/bug3118/node_modules/vite/dist/node/chunks/dep-76613303.js:59874:21
at Array.map (<anonymous>)
at ssrRewriteStacktrace (/tmp/bug3118/node_modules/vite/dist/node/chunks/dep-76613303.js:59873:10)
at Object.ssrFixStacktrace (/tmp/bug3118/node_modules/vite/dist/node/chunks/dep-76613303.js:60365:36)
at Object.handle_error (file:///tmp/bug3118/node_modules/@sveltejs/kit/dist/chunks/index.js:4392:15)
at respond (file:///tmp/bug3118/node_modules/@sveltejs/kit/dist/ssr.js:1841:11)System Info
System:
OS: Linux 5.15 Fedora Linux 35 (Workstation Edition)
CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
Memory: 1.75 GB / 15.28 GB
Container: Yes
Shell: 5.1.8 - /bin/bash
Binaries:
Node: 16.13.0 - /usr/bin/node
Yarn: 1.22.10 - /usr/bin/yarn
npm: 8.1.0 - /usr/bin/npm
Browsers:
Firefox: 95.0
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.10
@sveltejs/kit: next => 1.0.0-next.218
svelte: ^3.44.0 => 3.45.0Severity
annoyance
Additional Information
No response