fix: drop uuid dependency so requests work on React Native#224
Open
roymiloh wants to merge 1 commit into
Open
Conversation
uuid v13's v4() calls `crypto.getRandomValues()`, which React Native (Hermes) does not provide without the `react-native-get-random-values` polyfill, so it throws `crypto.getRandomValues() not supported`. This ran on every request in the axios interceptor, breaking all requests on React Native. The only use of uuid was a request-correlation id for in-iframe postMessage logging, which needs to be unique, not cryptographically random. Replace it with the existing `generateUuid()` (Math.random, already used for session/anonymous ids) and drop the uuid dependency entirely, so the SDK no longer requires a crypto polyfill. Adds a test that drives a request with `crypto` unavailable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/sdk@0.8.37-pr.224.eb846f3Prefer not to change any import paths? Install using npm alias so your code still imports npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.37-pr.224.eb846f3"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.8.37-pr.224.eb846f3"
}
}
Preview published to npm registry — try new features instantly! |
netanelgilad
approved these changes
Jul 8, 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
Follow-up to the React Native support work.
uuidv13'sv4()callscrypto.getRandomValues()internally, which React Native (Hermes) does not provide without thereact-native-get-random-valuespolyfill — it throwscrypto.getRandomValues() not supported. This ran on every request in the axios request interceptor (axios-client.ts), so all requests failed on React Native.Fix
uuidwas used in exactly one place: arequestIdused only for in-iframepostMessagerequest/response correlation. It needs to be unique, not cryptographically random.uuidv4()with the existinggenerateUuid()(Math.random-based, incommon.ts, already used for session/anonymous ids) — works in every environment.uuiddependency entirely (package.json + lockfile), so the SDK no longer depends oncrypto.getRandomValuesand consumers don't need a polyfill.Testing
cryptostubbed toundefined(the RN condition) and asserts it resolves and still attaches a correlation id.uuidremoval.🤖 Generated with Claude Code