service binding error.. why?

any ideas why i get this Error:
errorTypeError: The RPC receiver does not implement the method "textLableMatch".
errorTypeError: The RPC receiver does not implement the method "textLableMatch".
worker A "consumer":
export default {

async fetch(request, env, ctx) {
try {
const lables = ['stuff', 'bla', 'box'];
const text = 'blablablalballb!';

const result = await env.WORKER_TEXT_LABLE_MATCH.textLableMatch(lables, text);
return new Response(JSON.stringify(result));

} catch (error) {
return new Response("error" + error, { status: 500 });
}

},
};
export default {

async fetch(request, env, ctx) {
try {
const lables = ['stuff', 'bla', 'box'];
const text = 'blablablalballb!';

const result = await env.WORKER_TEXT_LABLE_MATCH.textLableMatch(lables, text);
return new Response(JSON.stringify(result));

} catch (error) {
return new Response("error" + error, { status: 500 });
}

},
};
Worker B "producer":
export class LableMatch extends WorkerEntrypoint {
async textLableMatch(lables, text) {
console.log('Running ai mathing');
console.log('lables:' + lables + 'text:' + text);
const result = await this.aiMatching(lables, text);
return result;
}
}
export class LableMatch extends WorkerEntrypoint {
async textLableMatch(lables, text) {
console.log('Running ai mathing');
console.log('lables:' + lables + 'text:' + text);
const result = await this.aiMatching(lables, text);
return result;
}
}
4 Replies
texan
texan3mo ago
Can you share your toml? How is your service binding defined in there? (Also note that your entrypoint for the producer must be in the main file)
Corsix👾
Corsix👾OP3mo ago
TOML file for consumer worker : #:schema node_modules/wrangler/config-schema.json name = "image-picker" main = "src/index.js" compatibility_date = "2024-09-09" compatibility_flags = ["nodejs_compat"] services = [ { binding = "WORKER_TEXT_LABLE_MATCH", service = "ai-text-label-match" } ] worker B producer code is in the main index file
Walshy
Walshy3mo ago
You'll want
services = [
{ binding = "WORKER_TEXT_LABLE_MATCH", service = "ai-text-label-match", entrypoint = "LableMatch" }
]
services = [
{ binding = "WORKER_TEXT_LABLE_MATCH", service = "ai-text-label-match", entrypoint = "LableMatch" }
]
see https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/rpc/#named-entrypoints for more
Corsix👾
Corsix👾OP3mo ago
oh okey, wasent shown in the example on that page so had no idea to add entrypoint = "LableMatch"
Want results from more Discord servers?
Add your server