-
Notifications
You must be signed in to change notification settings - Fork 773
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
[wrangler] feat: source map logged strings #4423
Conversation
🦋 Changeset detectedLatest commit: fac2f99 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7210693986/npm-package-wrangler-4423 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7210693986/npm-package-wrangler-4423 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7210693986/npm-package-wrangler-4423 dev path/to/script.js Additional artifacts:npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7210693986/npm-package-miniflare-4423 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7210693986/npm-package-cloudflare-pages-shared-4423 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7210693986/npm-package-create-cloudflare-4423 Note that these links will no longer work once the GitHub Actions artifact expires.
| Please ensure constraints are pinned, and |
5cd8f27
to
be11679
Compare
e36ad5f
to
92346bc
Compare
67b8104
to
664e4a4
Compare
1bf14b4
to
70d6a5d
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4423 +/- ##
==========================================
- Coverage 75.55% 75.44% -0.12%
==========================================
Files 242 242
Lines 12909 12957 +48
Branches 3320 3331 +11
==========================================
+ Hits 9753 9775 +22
- Misses 3156 3182 +26
|
70d6a5d
to
af01853
Compare
Looks like source mapping is slightly broken on Windows. 😕 Will investigate this when I'm next in the office. |
Equally I could take a look for you when I am next at home. |
ae8b919
to
fa9de6b
Compare
Co-authored-by: Steve Lam <stevyo99@yahoo.ca>
fa9de6b
to
0fd9b75
Compare
Use `@cspotcode/source-map-support` instead of `source-map-support`. This has some additional fixes for resolving paths on Windows, and is used by `ts-node`.
0fd9b75
to
fac2f99
Compare
Fixed this on Windows with fac2f99. It looks like |
@BrandonNoad unfortunately not. Deployed Workers and Pages Functions do not support source mapping yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - just added e2e test label.
E2Es are green and I tried this out on a local Windows machine. Ship it! |
Fixes #3383 and closes #3739.
What this PR solves / how to test:
Previously, Wrangler would only apply source mapping to uncaught exceptions. This meant if you caught an exception and logged its stack trace, the call sites would reference built JavaScript files as opposed to source files. This change looks for stack traces in logged messages, and tries to source map them.
Note source mapping is only applied when outputting logs.
Error#stack
does not return a source mapped stack trace. This means the actual runtime value ofnew Error().stack
and the output fromconsole.log(new Error().stack)
may be different.To test this, run the following worker with
wrangler dev
:Note how source mapping is applied in all cases.
Author has addressed the following:
Note for PR author:
We want to celebrate and highlight awesome PR review! If you think this PR received a particularly high-caliber review, please assign it the label
highlight pr review
so future reviewers can take inspiration and learn from it.