Bug: "Disallowed operation called within global scope" error in v2.0.41
Description
After upgrading from @rivetkit/cloudflare-workers@2.0.33 to @rivetkit/cloudflare-workers@2.0.41, the dev server fails to start with the error:
Uncaught Error: Disallowed operation called within global scope. Asynchronous I/O (ex: fetch() or connect()), setting a timeout, and generating random values are not allowed within global scope. To fix this error, perform this operation within a handler. https://developers.cloudflare.com/workersruntime-apis/handlers/
Environment
@rivetkit/cloudflare-workers: 2.0.41 (broken), 2.0.33 (works)
rivetkit: 2.0.41
wrangler: 4.60.0
- Platform: Cloudflare Workers
Steps to Reproduce
- Create a Cloudflare Workers project with RivetKit
- Use
@rivetkit/cloudflare-workers@2.0.41
- Run dev server
- Error occurs immediately
Workaround
Downgrade to version 2.0.33.