fix(objectstack): clean SDK client logger (no ANSI in RN/web) - #102
Merged
Conversation
Browser flow testing surfaced a red dev error toast showing raw ANSI escape codes: "[31m…ERROR[0m HTTP request failed". The SDK client's default logger formats with terminal ANSI colour codes + timestamps, which leak as literal "[31m…" text into the RN/web console and trip the dev error overlay (notably on a benign notifications 404). Pass a clean `logger` to every ObjectStackClient: plain console output, no ANSI; debug/info silenced outside __DEV__; SDK `error` routed to console.warn (so a benign HTTP failure no longer pops the red error overlay), `fatal` stays console.error. Verified in the browser against a live server: the ANSI error toast is gone. Suite 1266/1266, lint clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.
What
Found during a full browser flow-test of the AI assistant: a red dev error toast showing raw ANSI escape codes —
[31m…ERROR[0m HTTP request failed.The
@objectstack/clientSDK's default logger formats messages with terminal ANSI colour codes + timestamps. In React Native / web those escapes leak as literal[31m…text into the console and trip the dev error overlay (here, off a benignnotifications404 the example server doesn't implement).Fix
Pass a clean
logger(the SDK'sClientConfig.loggerhook) to everyObjectStackClient:consoleoutput, no ANSI;debug/infosilenced outside__DEV__;error→console.warn(a benign HTTP failure no longer pops the red error overlay),fatal→console.error.Verified
npm run lint0 errors;jest1266/1266.🤖 Generated with Claude Code