This is coming (HTTP Pull) in the future.
This is coming (HTTP Pull) in the future.




fetch handler so if you mean you want fetch w/ Hono and queue handlers in the same project, then just do it like this
scheduled worker right?



contentType option [1] and dead letter queues [2].contentType is set to anything other than "v8" and the queue event ends up in the DLQ, a consumer worker attached to that DLQ cannot handle it.
queuescheduled"v8"// Any contentType other than "v8" cannot be handled in the DLQ
env.MY_QUEUE.send({ foo: "bar" }, { contentType: "json" });
// This is handled fine by the DLQ consumer worker
env.MY_QUEUE.send({ foo: "bar" });
// This is also fine
env.MY_QUEUE.send({ foo: "bar" }, { contentType: "v8" });"Unable to deserialize cloned data due to invalid or unsupported version."export interface Env {
MY_QUEUE: Queue;
}
export default {
async fetch(req: Request, env: Env): Promise<Response> {
// Any contentType other than "v8" cannot be handled in the DLQ
await env.MY_QUEUE.send({ foo: 'bar' }, { contentType: 'json' });
return new Response('Sent message to the queue');
},
async queue(batch: MessageBatch<Error>, env: Env): Promise<void> {
// Due to this error, the event will end up in the dead letter queue
throw new Error('Foobar');
},
};export default {
async queue(batch: MessageBatch<Error>, env: Env): Promise<void> {
console.log(`Events received: ${JSON.stringify(batch.messages)}`);
},
};Unknown Event - Exception Thrown @ 10/10/2023, 3:10:17 PM
✘ [ERROR] Error: Unable to deserialize cloned data due to invalid or unsupported version.export interface Env {
MY_QUEUE: Queue;
}
export default {
async fetch(req: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
// if req.method is not POST , reject
if (req.method !== 'POST') {
return new Response('Sorry', { status: 405 });
}
const body = await req.json();
console.log(`got body: ${JSON.stringify(body)}`)
const result = await env.MY_QUEUE.send({
body: body,
contentType: "json",
});
console.log(`sent message to queue: ${JSON.stringify(result)}`);
return new Response(JSON.stringify({
return_code: "1",
return_message: "ok"
}), {
headers: { 'Content-Type': 'application/json' },
});
},
};"logs": [
{
"message": [
"got body: {\"data\":\"dat hart fd3 3\"}"
],
"level": "log",
"timestamp": 1696396087813
},
{
"message": [
"sent message to queue: undefined"
],
"level": "log",
"timestamp": 1696396087867
}
]export default {
fetch: app.fetch,
async queue(...) { ... }
}