-
Notifications
You must be signed in to change notification settings - Fork 87
Fix workflow stack traces (no more evalmachine) #256
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
Conversation
🦋 Changeset detectedLatest commit: 8c93c65 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
7cb7c5d to
649e9ca
Compare
TooTallNate
left a comment
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.
Couple small nits/questions, but otherwise
649e9ca to
8c93c65
Compare

Workflow code executes in a VM context via
runInContext(), which defaults toevalmachine.<anonymous>in stack traces, making debugging difficult:Fixes #151
Solution
This PR implements comprehensive source map support for workflow stack traces by:
runInContext()Changes
Core Runtime
packages/core/src/source-map.ts(NEW) - Source map remapping logic using@jridgewell/trace-mappingpackages/core/src/workflow.ts- UseparseWorkflowName()to extract clean file paths and pass asfilenameparameter torunInContext()packages/core/src/runtime.ts- Apply source map remapping to workflow error logsBuilder Configuration
packages/builders/src/base-builder.ts- Set intermediate workflow bundle to usesourcemap: 'inline'(the VM-executed code needs inline source maps)Tests
packages/core/src/workflow.test.ts- Added test for nested stack tracespackages/core/e2e/e2e.test.ts- Added e2e test for cross-file error stack tracesworkbench/example/workflows/helpers.ts(NEW) - Test helper module for verifying cross-file stack tracesworkbench/example/workflows/99_e2e.ts- AddednestedErrorWorkflowandcrossFileErrorWorkflowwith helper functionsDependencies
@jridgewell/trace-mappingto@workflow/corefor pure-JS source map processing (no WASM dependency)Results
Before
After - Simple Error
After - Nested Functions (Same File)
After - Cross-File Errors (Imported Modules)
Stack traces now correctly show:
evalmachine.<anonymous>)Testing
Fixes #151
This is part 1 of 3 in a stack made with GitButler: