question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[dev] display source mapped line numbers

See original GitHub issue

@xtuc has a WIP PR that would add sourcemaps to anything published with wrangler. we should utilize these maps in wrangler dev. @xtuc has already implemented source maps in the devtools protocol - the source map is accessible as base64 encoded json

Possible implementations

  • Implement in the runtime
    • JavaScript implementation
      • probably easier
    • C++/KJ implementation
      • possibly more performant

@xtuc would need to talk with runtime team about how we would possibly move forward with this approach. He noted a possible concern with regards to leaking meaningful stack traces in response bodies.

  • Implement everything in Wrangler
    • could parse base64 sourcemap from devtools and compute accurate line numbers from lineNumber and columnNumber fields from devtools
    • alternatively could read in source map from webpack config and not worry about base64 and compute accurate line numbers from lineNumber and columnNumber fields from devtools protocol

This approach is probably the easiest but would require any new clients to also implement their own source map handling approach. My guess is that long term we probably want the runtime to support this.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:18
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

13reactions
mroderickcommented, Sep 15, 2020

I think stale bot might have been a bit too keen to close this issue. I would still very much like to have source maps for my worker scripts

3reactions
xtuccommented, Jun 24, 2020

In wrangler dev we should make webpack always generate a sourcemap, serve it with a new local HTTP server and inject a sourceMappingURL in the worker that points locally.

When the worker runtime will load the worker it will send that source map URL to the devtools that it can download from the user endpoint.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I get the original line number and symbol from a ...
Show activity on this post. I have found the answer using this npm module: https://www.npmjs.org/package/source-map. Edit Feb 1st, 2015.
Read more >
How to use source maps for essential debugging - CodeSignal
In this engineering blog post we explain how we source maps can be used for debugging, for example between TypeScript and transpiled JS....
Read more >
Webpack from Nothing - Stack Traces and Line Numbers that ...
The main disadvantage is that it doesn't display line numbers correctly. Like…why am I using source maps if I am also OK with...
Read more >
Introduction to JavaScript Source Maps - Chrome Developers
Select "Get original location" will query the source map by passing in the generated line and column number, and return the position in...
Read more >
Debugging JavaScript with Source Maps - Rollbar
Generating a Source Map; How do Source Maps Work? ... Here we can see the proper source code with files, line numbers from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found