I'm trying to create a worker to use as a service binding following the instruction in the recent bl

I'm trying to create a worker to use as a service binding following the instruction in the recent blog post javascript native RPC but the worker fails immediately with the warning:
The entrypoint src/worker.js has exports like an ES Module, but hasn't defined a default export like a module worker normally would.

This is promptly followed by the error:
Uncaught Error: Dynamic require of "cloudflare:workers" is not supported\n


blog post link:
https://blog.cloudflare.com/javascript-native-rpc

How to fix?
The Cloudflare Blog
Cloudflare Workers now features a built-in RPC (Remote Procedure Call) system for use in Worker-to-Worker and Worker-to-Durable Object communication, with absolutely minimal boilerplate. We've designed an RPC system so expressive that calling a remote service can feel like using a library.
Was this page helpful?