Vitest monorepo service bindings and "The RPC receiver does not implement the method"
I have a monorepo that looks something like this:
The API package has wrangler service bindings to the Services package.
I’m using Vite and Vitest for testing the API package with the following vitest config
With this setup I currently get an error of the following shape
TypeError: The RPC receiver does not implement the method "getFoo".
when calling c.env.FOO_SERVICE.getFoo().
What’s the right way to tackle this?1 Reply
gotta add -c to the wrangler type command: https://developers.cloudflare.com/workers/runtime-apis/rpc/typescript/
Cloudflare Docs
TypeScript
How TypeScript types for your Worker or Durable Object's RPC methods are generated and exposed to clients