core icon indicating copy to clipboard operation
core copied to clipboard

Ability to set custom bindings on hub config, or overwrite `configPath` of `nitro-cloudflare-dev` from nuxthub

Open 9M6 opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe. I am not able to set QUEUE bindings or custom Bindings using nuxt.config.ts on NuxtHub

Describe the solution you'd like Make it so I can define custom bindings on the hub config

hub: {
  bindings: {
    queue: {
      name: "queue-name"
    }
  }
}

or allow the overwriting of configPath from nitro-cloudflare-dev directly from hub config.

Describe alternatives you've considered using fetch requests to generate the queue messages, and not depend on bindings.

Additional context Add any other context or screenshots about the feature request here.

9M6 avatar Sep 07 '24 04:09 9M6

Adding it to the list, this should not be hard to implement, ideally I would love to have a hubQueue(name) but quite frustrating to only be a producer.

Would you be happy if this is only a producer for now?

atinux avatar Sep 09 '24 17:09 atinux

Hey @atinux

Yes, a producer is great, I think that's the best use-case, since queues are handled by some other worker-script in my case, and I am using queues to delegate tasks to other scripts, since there's a limitation of 30s for function calls, but a 15min limitation for cron jobs and queue consumers.

But also in the future it would be nice to let nitro, or h3 define queues, scheduled and other stuff, similarly to hono.

9M6 avatar Sep 09 '24 17:09 9M6

Also would be nice to be able to customize configPath; if there's other bindings I can add to the script, I can manually add it and access it through an ENV variable; a bit dirty but as long as it does the job, not sure how hard this might be.

9M6 avatar Sep 09 '24 17:09 9M6

It's now possible to add additional bindings to NuxtHub projects, including the queue binding https://hub.nuxt.com/changelog/observability-additional-bindings

Additional bindings aren't available during development yet. We plan to bring on full support for queues soon via hubQueue() too!

export default defineNuxtConfig({
  hub: {
    workers: true,
    // database: true,
    // ...
    bindings: {
      queue: {
        BACKGROUND_JOBS: {
          queue_name: 'background-jobs'
        }
      }
    }
  }
})

RihanArfan avatar Apr 23 '25 20:04 RihanArfan

@RihanArfan can you share any information on what timeframe we are looking at for hubQueue() support? My site would really benefit from hubQueue and i'm excited to integrate it!

runarsventures avatar May 02 '25 13:05 runarsventures

@RihanArfan can you share any information on what timeframe we are looking at for hubQueue() support? My site would really benefit from hubQueue and i'm excited to integrate it!

We plan to in the coming weeks. You can follow #135 and see the workaround here. https://github.com/nuxt-hub/core/issues/135#issuecomment-2848751618

RihanArfan avatar May 03 '25 18:05 RihanArfan