Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fancy-apples-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@workflow/builders": patch
---

Enable source maps for step bundles to preserve original file paths in error stack traces
5 changes: 5 additions & 0 deletions .changeset/true-kings-exist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@workflow/core": patch
---

Correctly propagate stack traces for step errors
1 change: 1 addition & 0 deletions .github/workflows/e2e-community-world.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ jobs:
sleep 10
pnpm vitest run packages/core/e2e/e2e.test.ts --reporter=default --reporter=json --outputFile=e2e-community-${{ inputs.world-id }}.json || true
env:
NODE_OPTIONS: "--enable-source-maps"
APP_NAME: ${{ inputs.app-name }}
DEPLOYMENT_URL: "http://localhost:3000"
DEV_TEST_CONFIG: '{"name":"${{ inputs.app-name }}","project":"workbench-${{ inputs.app-name }}-workflow","generatedStepPath":"app/.well-known/workflow/v1/step/route.js","generatedWorkflowPath":"app/.well-known/workflow/v1/flow/route.js","apiFilePath":"app/api/chat/route.ts","apiFileImportPath":"../../.."}'
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ jobs:
- name: Run E2E Tests
run: pnpm run test:e2e --reporter=default --reporter=json --outputFile=e2e-vercel-prod-${{ matrix.app.name }}.json
env:
NODE_OPTIONS: "--enable-source-maps"
DEPLOYMENT_URL: ${{ steps.waitForDeployment.outputs.deployment-url }}
APP_NAME: ${{ matrix.app.name }}
WORKFLOW_VERCEL_SKIP_PROXY: 'true'
Expand Down Expand Up @@ -330,6 +331,7 @@ jobs:
pnpm vitest run packages/core/e2e/dev.test.ts; sleep 10
pnpm run test:e2e --reporter=default --reporter=json --outputFile=e2e-local-dev-${{ matrix.app.name }}-${{ matrix.app.canary && 'canary' || 'stable' }}.json
env:
NODE_OPTIONS: "--enable-source-maps"
APP_NAME: ${{ matrix.app.name }}
DEPLOYMENT_URL: "http://localhost:${{ matrix.app.name == 'sveltekit' && '5173' || (matrix.app.name == 'astro' && '4321' || '3000') }}"
DEV_TEST_CONFIG: ${{ toJSON(matrix.app) }}
Expand Down Expand Up @@ -396,6 +398,7 @@ jobs:
echo "starting tests in 10 seconds" && sleep 10
pnpm run test:e2e --reporter=default --reporter=json --outputFile=e2e-local-prod-${{ matrix.app.name }}-${{ matrix.app.canary && 'canary' || 'stable' }}.json
env:
NODE_OPTIONS: "--enable-source-maps"
APP_NAME: ${{ matrix.app.name }}
DEPLOYMENT_URL: "http://localhost:${{ matrix.app.name == 'sveltekit' && '4173' || (matrix.app.name == 'astro' && '4321' || '3000') }}"

Expand Down Expand Up @@ -481,6 +484,7 @@ jobs:
echo "starting tests in 10 seconds" && sleep 10
pnpm run test:e2e --reporter=default --reporter=json --outputFile=e2e-local-postgres-${{ matrix.app.name }}-${{ matrix.app.canary && 'canary' || 'stable' }}.json
env:
NODE_OPTIONS: "--enable-source-maps"
APP_NAME: ${{ matrix.app.name }}
DEPLOYMENT_URL: "http://localhost:${{ matrix.app.name == 'sveltekit' && '4173' || (matrix.app.name == 'astro' && '4321' || '3000') }}"

Expand Down Expand Up @@ -542,6 +546,7 @@ jobs:
Stop-Job $job
shell: powershell
env:
NODE_OPTIONS: "--enable-source-maps"
APP_NAME: "nextjs-turbopack"
DEPLOYMENT_URL: "http://localhost:3000"
DEV_TEST_CONFIG: '{"generatedStepPath":"app/.well-known/workflow/v1/step/route.js","generatedWorkflowPath":"app/.well-known/workflow/v1/flow/route.js","apiFilePath":"app/api/chat/route.ts","apiFileImportPath":"../../..","port":3000}'
Expand Down
11 changes: 7 additions & 4 deletions packages/builders/src/base-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export abstract class BaseBuilder {
write: false,
outdir,
bundle: true,
sourcemap: EMIT_SOURCEMAPS_FOR_DEBUGGING,
sourcemap: false,
absWorkingDir: this.config.workingDir,
logLevel: 'silent',
});
Expand Down Expand Up @@ -339,8 +339,11 @@ export abstract class BaseBuilder {
'.mjs',
'.cjs',
],
// TODO: investigate proper source map support
sourcemap: EMIT_SOURCEMAPS_FOR_DEBUGGING,
// Inline source maps for better stack traces in step execution.
// Steps execute in Node.js context and inline sourcemaps ensure we get
// meaningful stack traces with proper file names and line numbers when errors
// occur in deeply nested function calls across multiple files.
sourcemap: 'inline',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only change that gives me a tiny bit of pause - does this affect performance? It'd be nice to take a quick look at bundle times and see if it's relevant, given we already have complaints about bundling/discovery time, and the caching PR from JJ was reverted recently

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the perf issues were primarily happening in the "discovering workflows/steps" bit - which is not the same as this esbuild.

This shouldn't meaningfully affect benchmarking yet, but we probably should start benchmarking build times soon too @ijjk as you dig deeper into that

plugins: [
createSwcPlugin({
mode: 'step',
Expand Down Expand Up @@ -747,7 +750,7 @@ export const OPTIONS = handler;`;
'.mjs',
'.cjs',
],
sourcemap: false,
sourcemap: EMIT_SOURCEMAPS_FOR_DEBUGGING,
mainFields: ['module', 'main'],
// Don't externalize anything - bundle everything including workflow packages
external: [],
Expand Down
Loading
Loading