Service binding RPC method null

I have a project with a service binding I call like this:

const result = await ctx.runtime.env.CRYPTO.encrypt(arg)


Despite the service being bound correctly, I ge this in production:

TypeError: ctx.runtime.env.CRYPTO.encrypt is not a function


Logging this

console.log(
ctx.runtime.env.CRYPTO.fetch,
typeof ctx.runtime.env.CRYPTO.fetch,
ctx.runtime.env.CRYPTO.encrypt,
typeof ctx.runtime.env.CRYPTO.encrypt,
)


Gives
"function fetch() { [native code] }",
"function",
null,
"undefined"


I can rewrite it using fetch, but are these supposed to work?
Was this page helpful?