N
Nuxt3mo ago
miSko

How to add Service Binding to NuxtHub project

Hello! I am doing a project with nuxthub and I need to add the "service binding" to call other workers directly. In the CF documentation, they are declared in the "wrangler" file, but since I cannot modify it with NuxtHub, I would like to know how to add them. https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/
Cloudflare Docs
Service bindings | Cloudflare Workers docs
Facilitate Worker-to-Worker communication.
7 Replies
bryce
bryce3mo ago
I don't think NuxtHub currently supports these bindings automatically
miSko
miSkoOP3mo ago
And wouldn't there be some way to modify, even manually, some file, so that it adds that information to the "Wrangler" file? I just need to add the information to that file for it to be recognized by CF. If I can't, I would have to stop using nuxthub until they add this functionality and I prefer not to stop using it hahaha
MEE6
MEE63mo ago
ohb00 has been warned
Reason: Posted an invite
bryce
bryce3mo ago
ok well thats absurd as its a link to NuxtHub discord I was going to say, I think you can add the Binding in the Cloudflare dashboard but it'll disappear with the next deployment. It might be possible to add support if you're willing to hack onto the https://github.com/nuxt-hub/core package. I think there are plans in the future for more bindings but none yet You should ask in the NuxtHub discord, but I'm not allowed to post an invite apparently Something like this: https://github.com/nuxt-hub/core/pull/173 You'd basically just need to extend this function I think: https://github.com/nuxt-hub/core/blob/3eda06a7fbe76c5e07e115dbdbef419fd0312e66/src/utils/wrangler.ts#L3
miSko
miSkoOP3mo ago
i will check it tomorrow, thx for the links 🙂 OK, I've already been testing. By modifying that file, I have managed to get the ‘Worker2Worker’ to work correctly locally. To make it work once uploaded to Cloudflare, I had to add it manually from CF to the project. As NuxtHUB doesn't support it, it doesn't overwrite it between deploys either, so once configured it stays working without any problem. At least, it is a workaround that allows to keep working with nuxthub and external workers.
miSko
miSkoOP3mo ago
node_modules/@nuxthub/core/dist/module.mjs Thanks @bryce for ur help 🙂
Want results from more Discord servers?
Add your server