fix(vtex): surface real cause of "typo in url or port" errors#423
Merged
viniciusventura29 merged 1 commit intoMay 6, 2026
Merged
Conversation
When state.accountName arrived empty the URL became "https://.vtexcommercestable.com.br" and Bun rejected it with a cryptic "Was there a typo in the url or port?". This swaps that for a fail-fast assertion that names the missing field, attaches credential-source context to SDK errors, and logs the resolved baseUrl + mesh-context shape so the inconsistent state-propagation path can be diagnosed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 6, 2026
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
state.accountNamearrived empty, the URL becamehttps://.vtexcommercestable.com.brand Bun rejected it with the cryptic"Was there a typo in the url or port?"— across many tools.assertValidCredentialscheck that throws a descriptive error naming the missing field, used in the generated-tool adapter and both custom tools (reorder-collection,update-product-specifications).[tool=… account=… accountSource=state|env|missing …]) and logs the resolved baseUrl + mesh-context shape on every tool call so the inconsistent state-propagation path can be diagnosed in production.Test plan
bun run check(vtex) — passesbun test(vtex) — 77 pass, 0 failVTEX_ACCOUNT_NAMEnow returns the descriptive fail-fast error instead of the Bun "typo in url or port" messagestateis properly injected,[VTEX] tool=… mesh-context-shape: {hasToken:true, stateAccountNamePresent:true, …}is logged and the call succeeds🤖 Generated with Claude Code
Summary by cubic
Fail-fast validation for VTEX tools to prevent invalid base URLs and replace Bun’s “Was there a typo in the url or port?” with a clear error when
accountNameis missing. Adds source-aware error context and lightweight logging to make config issues easy to diagnose.assertValidCredentialsin the tool adapter and custom tools to throw a clear error whenaccountNameis missing (avoidshttps://.vtexcommercestable.com.br).resolveCredentialsto pull fromstateor env and return per-fieldsources; warns whenaccountNameis missing.[tool=… account=… accountSource=…]context.Written for commit 2052d4e. Summary will update on new commits.