-
Notifications
You must be signed in to change notification settings - Fork 98
Fix Windows path normalization in workflow lookup #300
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
base: main
Are you sure you want to change the base?
Conversation
Fixed Windows filesystem support for Vercel Workflow ## Issue Description Users on Windows were experiencing the following error when using workflows: ``` ReferenceError: Workflow "workflow//C:\\dev\\birthday-card-generator\\app\\api\\generate\\route.ts//handleOrder" must be a function, but got "undefined" instead ``` 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.ts` to normalize Windows path separators before attempting to retrieve workflows from the registry: ### Files Modified: 1. **packages/core/src/workflow.ts** - Added path normalization before workflow lookup: `workflowRun.workflowName.replace(/\\/g, '/')` - Updated error message to use the normalized name for consistency 2. **packages/core/src/parse-name.test.ts** - Added test case to verify Windows path normalization works correctly - Test covers the specific error scenario from the bug report 3. **packages/core/src/workflow.test.ts** - Added end-to-end test for Windows path handling in workflow execution - Test simulates the exact scenario where a workflow is registered with forward slashes but looked up with backslashes ## 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 - All existing tests continue to pass - New tests specifically validate Windows path handling - The fix addresses the exact error scenario reported by the user This change maintains backward compatibility while fixing Windows filesystem support without affecting Unix/Linux systems. Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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