feat: move base URLs to credentials for n8n Connect support#19
Open
alexander-gekov wants to merge 3 commits into
Open
feat: move base URLs to credentials for n8n Connect support#19alexander-gekov wants to merge 3 commits into
alexander-gekov wants to merge 3 commits into
Conversation
Move the hardcoded REST (api.browserbase.com) and Stagehand (api.stagehand.browserbase.com) base URLs into the Browserbase API credential as `baseUrl` and `stagehandBaseUrl` fields. The node now reads these at runtime, falling back to the previous hardcoded values when unset, so existing credentials and default behavior are unchanged. This lets operators point the node at a proxy or regional endpoint, and allows the base URL to be overridden by gateways/proxies that swap the credential URL field. Co-authored-by: Cursor <cursoragent@cursor.com>
Make the baseUrl/stagehandBaseUrl credential fields hidden and gate credential-based URL resolution on node typeVersion: nodes at version 2 keep using the hardcoded constants, while version 2.1 (the new default) reads the URLs from the credential. n8n applies credential defaults at decrypt time, so existing credentials resolve to the same values. This mirrors the pattern used by the n8n team for n8n Connect support (hidden URL field + typeVersion bump) and guarantees existing workflows are unaffected. Co-authored-by: Cursor <cursoragent@cursor.com>
On v2.1 nodes, credentials saved before the hidden URL fields existed (or otherwise lacking them) yield an undefined value, which crashed normalizeBaseUrl. Fall back to the hardcoded constants when the credential URL is empty so resolution never throws. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
baseUrl(https://api.browserbase.com) andstagehandBaseUrl(https://api.stagehand.browserbase.com) fields to thebrowserbaseApicredential, so the base URLs can be injected/overridden at runtime (e.g. by n8n Connect, a proxy, or a regional endpoint).typeVersionto2.1so credential-aware URL resolution is used on fresh installs, while existing nodes (typeVersion 2) keep using the hardcoded constants — no breaking change.baseUrl.Why
n8n Connect requires the base URL to be configurable via credentials rather than hardcoded in the node. Gating on
typeVersionensures backward compatibility with nodes already saved by users (they stay on v2 and behave identically). n8n applies credential defaults at decrypt time, so existing credentials resolve to the same URLs without any migration.This mirrors the approach used for other community nodes (e.g. PDF.co): a hidden URL field plus a
typeVersionbump.Backwards compatibility
Test plan
npm run lintpassesnpm run buildpassesbaseUrlreroutes Search/Fetch on a v2.1 node