Skip to content

Fix :"Invalid URL" error in workflow execution when base URLs are undefined#28347

Open
Bakul2006 wants to merge 1 commit inton8n-io:masterfrom
Bakul2006:bakul2006/fixInvalid_URL
Open

Fix :"Invalid URL" error in workflow execution when base URLs are undefined#28347
Bakul2006 wants to merge 1 commit inton8n-io:masterfrom
Bakul2006:bakul2006/fixInvalid_URL

Conversation

@Bakul2006
Copy link
Copy Markdown

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

  • I have seen this code, I have run this code, and I take responsibility for this code.
  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with Backport to Beta, Backport to Stable, or Backport to v1 (if the PR is an urgent fix that needs to be backported)

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 10, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

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
Loading

@n8n-assistant n8n-assistant bot added community Authored by a community member core Enhancement outside /nodes-base and /editor-ui in linear DEPRECATED labels Apr 10, 2026
@n8n-assistant
Copy link
Copy Markdown
Contributor

n8n-assistant bot commented Apr 10, 2026

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:
• Tests are included for any new functionality, logic changes or bug fixes.
• The PR aligns with our contribution guidelines.

Regarding new nodes:
We no longer accept new nodes directly into the core codebase. Instead, we encourage contributors to follow our Community Node Submission Guide to publish nodes independently.

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:
This PR has been added to our internal tracker as "GHC-7686". While we plan to review it, we are currently unable to provide an exact timeframe. Our goal is to begin reviews within a month, but this may change depending on team priorities. We will reach out when the review begins.

Thank you again for contributing to n8n.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Authored by a community member core Enhancement outside /nodes-base and /editor-ui in linear DEPRECATED

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants