Any known issue with queues on wranger

Any known issue with queues on wranger locally and react router apps? Can create a repro just wanted to check if it's something obvious first. ✘ [ERROR] Uncaught Error: Handler does not export a queue() function Got this in my workers/app.ts
export default {
async queue(batch: MessageBatch, env: any, ctx: ExecutionContext): Promise<void> {
for (const message of batch.messages) {
console.log('Received', message)
}
},
export default {
async queue(batch: MessageBatch, env: any, ctx: ExecutionContext): Promise<void> {
for (const message of batch.messages) {
console.log('Received', message)
}
},
3 Replies
will smith
will smithOP4w ago
running npx wrangler@latest dev. I've also got async fetch and async scheduled in there which work fine (except for scheduled in local obviously)
Sid
Sid4w ago
Well that’s interesting. Can you file an issue on Wrangler and include your wrangler version? (Although it looks like you’ve been able to repro on the latest version as well)
Gravite2090
Gravite20903w ago
I think you want ExportedHandler vs Handler if you can grab it from your cloudflare worker types / wrangler generated types.
export default {
async queue(batch: MessageBatch<any>, env: Env, ctx: ExecutionContext): Promise<void> {
...
} satisfies ExportedHandler<Env, Error>;
export default {
async queue(batch: MessageBatch<any>, env: Env, ctx: ExecutionContext): Promise<void> {
...
} satisfies ExportedHandler<Env, Error>;

Did you find this page helpful?