fix(auth): clear errors for missing BL_WORKSPACE/BL_API_KEY (ENG-2698)#326
Merged
mstolarzblaxelai merged 1 commit intoMay 29, 2026
Merged
Conversation
Missing or partial credentials silently coalesced to empty strings, so the SDK sent empty workspace/authorization headers and the user hit the server's misleading "workspace is required" with no client-side guidance. Fail fast with a clear, actionable error naming the missing piece (BL_API_KEY / BL_WORKSPACE / `bl login`) before any request: - authentication() returns a MissingCredentials marker instead of empty creds - settings.headers and settings.authenticate() validate via assertCredentials - forceUrl sessions (own headers) and sentry workspace tagging are unaffected Mirrors the Python fix (sdk-python #153, ENG-2253).
Contributor
There was a problem hiding this comment.
LGTM
The fail-fast logic is correct: MissingCredentials is caught before the workspace check, the workspace check catches partial configs (ApiKey without workspace), and sandbox forceUrl paths bypass settings.headers entirely and never call authenticate(). No security, correctness, or data-loss issues found.
Tag @mendral-app with feedback or questions. View session
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.
Fixes ENG-2698.
bl login) before any request goes out.Mirrors the Python fix (blaxel-ai/sdk-python#153).
Note
Adds fail-fast credential validation to the TypeScript SDK. When
BL_API_KEYorBL_WORKSPACEare missing,authentication()now returns aMissingCredentialsmarker instead of an emptyCredentials. A newassertCredentials()method called from bothsettings.headersandsettings.authenticate()throws aCredentialsErrorwith an actionable message naming the missing piece before any HTTP request goes out. Mirrors the Python SDK fix (sdk-python#153).Written by Mendral for commit 3a82dc8.