Fix :"Invalid URL" error in workflow execution when base URLs are undefined#28347
Fix :"Invalid URL" error in workflow execution when base URLs are undefined#28347Bakul2006 wants to merge 1 commit inton8n-io:masterfrom
Conversation
There was a problem hiding this comment.
No issues found across 4 files
Architecture diagram
sequenceDiagram
participant Ext as Webhook / Form Client
participant WebhookSvc as Webhook Service (CLI)
participant Util as getAdditionalKeys Utility
participant Engine as Execution Engine
participant Context as Node Execution Context
Note over WebhookSvc,Context: Workflow Execution Flow with Waiting URLs
Ext->>WebhookSvc: Incoming Webhook Request
WebhookSvc->>Util: Request Proxy Metadata (getAdditionalKeys)
alt CHANGED: webhookWaitingBaseUrl is defined
Util->>Util: Construct $execution.resumeUrl
else Base URL undefined
Util->>Util: NEW: Set $execution.resumeUrl to empty string
end
alt CHANGED: formWaitingBaseUrl is defined
Util->>Util: Construct $execution.resumeFormUrl
else Base URL undefined
Util->>Util: NEW: Set $execution.resumeFormUrl to empty string
end
Util-->>WebhookSvc: Return metadata ($execution, $resumeWebhookUrl)
WebhookSvc->>Engine: Start Execution
Engine->>Context: Initialize Node Execution
Context->>Context: NEW: Validate webhookWaitingBaseUrl existence
alt Base URL missing
Context-->>Engine: Throw UnexpectedError ("URL not configured")
else Base URL present
Context->>Context: Construct node-specific baseURL (new URL)
end
Engine-->>WebhookSvc: Return Run Data (resumeToken)
opt CHANGED: Response Mode is 'formPage'
alt formWaitingBaseUrl is defined
WebhookSvc->>WebhookSvc: Safe construct form URL with resumeToken
WebhookSvc-->>Ext: 200 OK (formWaitingUrl)
else Base URL undefined
Note right of WebhookSvc: NEW: Skip URL construction to prevent crash
WebhookSvc-->>Ext: Return Handled Response
end
end
|
Hey @Bakul2006, Thank you for your contribution. We appreciate the time and effort you’ve taken to submit this pull request. Before we can proceed, please ensure the following: Regarding new nodes: If your node integrates with an AI service that you own or represent, please email nodes@n8n.io and we will be happy to discuss the best approach. About review timelines: Thank you again for contributing to n8n. |
Summary
Fixes a regression introduced in versions >2.13.4 where workflows fail at the first node with a TypeError: Invalid URL error when base URLs are undefined.
The issue occurred due to unsafe URL construction in multiple places. When webhookWaitingBaseUrl or formWaitingBaseUrl were undefined or empty, the code generated invalid URLs like:
undefined/
This caused the new URL() constructor to throw an exception, preventing workflow execution.
Related Linear tickets, Github issues, and Community forum posts
fixes the issue #28346
Review / Merge checklist
Backport to Beta,Backport to Stable, orBackport to v1(if the PR is an urgent fix that needs to be backported)