Skip to content

Fix TypeError: crypto.randomUUID in ExampleWorkbench and SandboxBrowser - #1245

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/safe-random-uuid-client
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/safe-random-uuid-client

Conversation

@sentry

@sentry sentry Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

This PR addresses the TypeError: crypto.randomUUID is not a function that occurred in ExampleWorkbench.client.tsx and SandboxBrowser.client.tsx.

Problem:
The crypto.randomUUID() function is not available in non-secure contexts (HTTP) or on older/non-standard browsers. Both ExampleWorkbench and SandboxBrowser components were calling this function directly during initialization, leading to errors for affected users.

Solution:

  1. A new client-side utility, src/utils/crypto.client.ts, was created to export a safeRandomUUID() function.
  2. This safeRandomUUID() function implements a robust fallback mechanism:
    • It first attempts to use crypto.randomUUID().
    • If unavailable, it falls back to crypto.getRandomValues().
    • As a last resort, it generates a UUID-like string using Date.now() + Math.random().
      This pattern is inspired by the existing createPartnerPlacementSessionSeed in src/utils/partner-placement.ts.
  3. All direct calls to crypto.randomUUID() in ExampleWorkbench.client.tsx (5 instances) and SandboxBrowser.client.tsx (2 instances) have been replaced with safeRandomUUID().

Fixes TANSTACK-COM-4PS

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 76d25dcd-ea05-40e0-973e-0f6a819118ab

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tanstack-com 3f4a80e Commit Preview URL

Branch Preview URL
Sep 10 2026, 11:06 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants