Fix Windows path normalization in workflow lookup #300
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What was implemented
Fixed Windows filesystem support for Vercel Workflow
Issue Description
Users on Windows were experiencing the following error when using workflows:
The problem was that workflow names contained Windows path separators (backslashes) during lookup, but workflows were registered with normalized paths (forward slashes) during the SWC transform process.
Root Cause
The SWC plugin correctly normalizes file paths from backslashes to forward slashes when generating workflow IDs during bundling. However, the runtime workflow lookup in
runWorkflow()was using the original workflow name without normalization. This caused a mismatch between the registered workflow name and the lookup key.Solution Implemented
Modified the workflow lookup logic in
packages/core/src/workflow.tsto normalize Windows path separators before attempting to retrieve workflows from the registry:Files Modified:
packages/core/src/workflow.ts
workflowRun.workflowName.replace(/\\/g, '/')packages/core/src/parse-name.test.ts
packages/core/src/workflow.test.ts
Technical Details
The fix ensures that both the workflow registration (via SWC transform) and workflow lookup (via runtime) consistently use forward slash path separators, eliminating the Windows-specific path mismatch issue.
Testing
This change maintains backward compatibility while fixing Windows filesystem support without affecting Unix/Linux systems.
Code Generation Context
This PR was automatically generated by Vercel Agent