also is there not a way to expicitly reject a message and have it go directly to the DLQ?
also is there not a way to expicitly reject a message and have it go directly to the DLQ?
undefined causing all sorts of problems


this.state.id to just "hello", does it work? What are you actually trying to do?
this.state.id, which doesn't directly serialize to JSON. I've PR'ed the docs to fix this: https://github.com/cloudflare/cloudflare-docs/pull/14665 - it needs to be this.state.id.toString()queue() handler accepts a message, the Env, and the context per https://developers.cloudflare.com/queues/configuration/javascript-apis/#consumer
context.get('variable') within the queue? My CTX is empty within the Queue consumerapp.get('/manual-screenshot', async (c) => {
const url = c.req.query('url');
if (!url) {
return c.json({ message: 'Please provide a URL' });
}
const fullPageScreenshotUrl = await takeScreenshot(c.env.MYBROWSER, c.env.SCREENSHOT_BUCKET, url); // Function that takes screenshot, uploads to R2 bucket, and returns URL
return c.json({ fullPageScreenshotUrl });
});app.get('/take-screenshot', async (c) => {
const url = c.req.query('url');
if (!url) {
return c.json({ message: 'Please provide a URL' });
}
// Add to queue
await c.env.ScreenshotQueue.send({ url });
return c.json({ message: 'success' });
});
export default {
fetch: app.fetch,
async queue(batch, env): Promise<void> {
console.log(batch);
const messages = JSON.stringify(batch.messages);
console.log(`consumed from our queue: ${messages}`);
switch (batch.queue) {
case 'screenshot-queue':
for (const message of batch.messages) {
const { url } = message.body;
if (!url) {
console.error('Missing URL');
return;
}
const fullPageScreenshotUrl = await takeScreenshot(env.MYBROWSER, env.SCREENSHOT_BUCKET, url);
console.log(fullPageScreenshotUrl)
message.ack();
}
break;
}
},
} satisfies ExportedHandler<Env>;