Dynamic require of "cloudflare:workers" is not supported

I'm trying to create a cloudflare worker that is accessed via services by another worker. I followed the example here https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/
The worker fails to deploy with the error in the title. I aslo get this warning: ▲ [WARNING] The entrypoint src/gemini.ts has exports like an ES Module, but hasn't defined a default export like a module worker normally would. Building the worker using "service-worker" format...

Service Worker wrangler toml:
name = "iai-gemini"
main = "src/gemini.ts"
compatibility_date = "2024-08-06"
compatibility_flags = ["nodejs_compat"]


Service worker code (too long for discord)
https://pastebin.com/VraghKaZ
Cloudflare Docs
Facilitate Worker-to-Worker communication.
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Was this page helpful?