solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

[Bug?]: error sourcemap is wrong

Open huseeiin opened this issue 5 months ago • 3 comments

Duplicates

  • [x] I have searched the existing issues

Latest version

  • [x] I have tested the latest version

Current behavior 😯

Image

Expected behavior 🤔

it should be line 2

Steps to reproduce 🕹

export default function Home() {
  throw new Error("yes");
}

Context 🔦

No response

Your environment 🌎


huseeiin avatar Jul 05 '25 08:07 huseeiin

Do you have a fix for this @huseeiin ?

brenelz avatar Aug 04 '25 02:08 brenelz

Do you have a fix for this @huseeiin ?

no, i wish i did

huseeiin avatar Aug 04 '25 07:08 huseeiin

Let me add some more info to this bug report. I got it by adding a line in Counter.tsx in the default app made by pnpm create solid, like this:

export default function Counter() {
  throw new Error("ooo");
  ...

As a result, the error page points to a wrong line, but also the error logged to the console, when I click the Counter.tsx link in the stacktrace, opens a view of the file with the wrong line marked. There is also one more exception in the console:

dev.js:1599 Error: "null" is not in the SourceMap.
    at BasicSourceMapConsumer.SourceMapConsumer_sourceContentFor [as sourceContentFor] (source-map-consumer.js:794:13)
    at Object.fn (createStackFrame.js:44:36)
    at runComputation (dev.js:742:22)
    at updateComputation (dev.js:724:3)
    at runTop (dev.js:833:7)
    at runQueue (dev.js:904:42)
    at completeUpdates (dev.js:860:84)
    at runUpdates (dev.js:850:5)
    at completeLoad (dev.js:330:5)
    at loadEnd (dev.js:325:14)

I realised that the file that reportedly originated this error is this: http://localhost:3000/home/tpreal/git/solid-project/src/components/Counter.tsx. This includes my local path, and it is wrong. If I throw an error e.g. in a createEffect, the file that throw it is http://localhost:3000/_build/src/components/Counter.tsx, and then everything, including the source maps, works correctly.

TPReal avatar Aug 28 '25 11:08 TPReal