Registry / devops / nuxt-cf-jobs

nuxt-cf-jobs

JSON →
library0.6.3jsnpmunverified

Nuxt module (v0.6.3, active development) that provides typed integration with Cloudflare Queues for Nuxt 3+ applications. It auto-generates TypeScript types for queue bindings and consumer payloads, offers a composable for sending jobs, and supports local development via wrangler.toml. Compared to raw @cloudflare/workers-types or wrangler CLI, it offers native Nuxt module configuration and type safety out of the box. Compatible with Nuxt >=3.0.0 <5.0.0.

npm install nuxt-cf-jobs
INSTALL
IMPORT
SIG · NUXT-CF-JOBS
N
nuxt-cf-jobs
devopsjavascriptv0.6.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

useQueue
import { useQueue } from 'nuxt-cf-jobs'
import useQueue from 'nuxt-cf-jobs'
Named export, not default. ESM only.
defineQueueConsumer
import { defineQueueConsumer } from 'nuxt-cf-jobs'
const { defineQueueConsumer } = require('nuxt-cf-jobs')
ESM-only package, CommonJS require not supported.
type QueuePayload
import type { QueuePayload } from 'nuxt-cf-jobs'
TypeScript type import; use `import type` for type-only imports.

Configure a Cloudflare queue in nuxt.config.ts, define a consumer handler, and send jobs from anywhere using the useQueue composable.

// nuxt.config.ts export default defineNuxtConfig({ modules: ['nuxt-cf-jobs'], cfJobs: { queues: { myQueue: { binding: 'MY_QUEUE', consumer: './server/queue/myQueue.consumer.ts', }, }, }, }) // server/queue/myQueue.consumer.ts import { defineQueueConsumer } from 'nuxt-cf-jobs' export default defineQueueConsumer(async (batch, env, ctx) => { for (const msg of batch.messages) { console.log('Processing', msg.body) } }) // pages/index.vue const { send } = useQueue() await send('myQueue', { id: 1, data: 'hello' })
Debug
Known issues
deprecatedThe experimental option `queueBindings` has been removed in favor of `queueConfig` since v0.5.0.
fix
Use `cfJobs.queues` configuration instead.
affects: >=0.5.0
breakingIn v0.6.0, the `useQueue()` composable no longer accepts a queue name as first argument; queue name must be passed to `send()` method.
fix
Update calls: from `useQueue('myQueue').send(payload)` to `useQueue().send('myQueue', payload)`
affects: >=0.6.0
gotchaWhen using multiple queues, consumer files must be in separate files; inline consumers are not supported.
fix
Create a separate consumer file per queue and reference it in the module configuration.
affects: <=0.6.3
gotchaThe module requires `wrangler.toml` or Cloudflare bindings to be configured for local development to work properly.
fix
Ensure your Cloudflare environment variables and queue bindings are set in your development environment.
affects: >=0.1.0
deprecatedSupport for Nuxt 2 was dropped in v0.4.0.
fix
Upgrade to Nuxt 3+ or use an older version of this module.
affects: >=0.4.0
Errors
Common errors & fixes
Cannot find module 'nuxt-cf-jobs' or its corresponding type declarations.
The package may not be installed or tsconfig doesn't include node_modules types.
fix
Run `npm install nuxt-cf-jobs` and ensure 'types' is in 'compilerOptions' in tsconfig.json.
useQueue is not defined
Trying to use the composable outside of a Vue component or setup context that has Nuxt auto-imports enabled.
fix
Use `const { send } = useQueue()` within `<script setup>` or `defineComponent` setup function.
The request to enqueue a message failed with status 403: Forbidden
Cloudflare queue binding not configured correctly (missing or incorrect binding name in wrangler.toml or Nuxt config).
fix
Verify binding name matches the one defined in `cfJobs.queues` and corresponding Cloudflare environment.
Cannot read properties of undefined (reading 'messages')
Consumer function expects a 'batch' object with 'messages' property, but the received object is malformed (e.g., wrong queue consumer signature).
fix
Ensure the consumer follows the correct signature: `defineQueueConsumer(async (batch, env, ctx) => {...})`
Upgrade
Version history
0.6.3latest on npm
Audit
Dependencies
nuxtrequiredpeer dependency required for module functionality
Agent activity
2 hits · last 30 days
node
2
Resources
nuxt-cf-jobs — npm install nuxt-cf-jobs · libregistry