You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cloudflare Workers crash on import in @tanstack/db 0.8.5 due to global crypto.getRandomValues() #1781
I've validated the bug against the latest version of DB packages
Describe the bug
@tanstack/[email protected] crashes Cloudflare Workers during module initialization. The newly added runtime reference identity initializer calls crypto.getRandomValues() in global scope, which Cloudflare Workers disallows.
Because this happens before the request handler runs, every request returns HTTP 500.
Import useLiveQuery from @tanstack/react-db in an application bundled for Cloudflare Workers.
Deploy the Worker.
Request any route.
Observe an HTTP 500 response and the global-scope runtime error.
Expected behavior
Importing TanStack DB should not perform operations forbidden during Worker module initialization. The runtime namespace should be initialized lazily during request execution.
Screenshots
Not applicable. Cloudflare Observability reports:
Error: Disallowed operation called within global scope.
Asynchronous I/O, setting a timeout, and generating random values are not
allowed within global scope.
at assets/build/.../useLiveQuery-....js
Desktop (please complete the following information):
OS: Cloudflare Workers runtime
Browser: Not applicable (failure occurs before a response is rendered)
Version Compatibility date 2026-07-30, Wrangler 4.126.0
Smartphone (please complete the following information):
Device: Not applicable
OS: Not applicable
Browser Not applicable
Version Not applicable
Additional context
The apparent source is db/src/query/runtime-reference-identity.ts (line 24):
Activity