Hi - I'm new myself, so this may be BS - but I think you need to define 2 workers, one that is the p
Hi - I'm new myself, so this may be BS - but I think you need to define 2 workers, one that is the producer and one that is the consumer.
Known Issues
Wrangler does not yet support running separate producer and consumer Workers bound to the same Queue locally. To develop locally with Queues, you can temporarily put your consumer’s queue() handler in the same Worker as your producer, so the same Worker acts as both a producer and consumer.
Wrangler also does not yet support wrangler dev --remote.



fetch, it just skip / stops running. Yesterday I assumed that the fetches were disabled on the queue, but minutes ago I saw an example on the CF Docs where a fetch is made inside a queue.https://developers.cloudflare.com/queues/examples/web-crawler-with-browser-rendering/#6-crawl-with-puppeteer
await ing the fetch? Do you have a try-catch handler and are you seeing any errors logged?awaiting the fetch and I also put inside a try/catch, but no error is logged. API URL log, and then the code skips everything below the logsend and sendBatch methods returning a single (or array of for batch) string(s) representing each message sent to the queuePromise<void>, is there any chance that this might come along, or even be an option to enable it in the command itself (eg MY_QUEUE.send('my payload', {resolveId: true})




fetchestry-catchtry/catchsendsendBatchPromise<void>MY_QUEUE.send('my payload', {resolveId: true})try {
console.log('API URL :', `${env.STRAPI_API_URL}/c-orders`);
const connection = await fetch(`${env.STRAPI_API_URL}/c-orders`, {
headers: {
Authorization: `Bearer ${env.STRAPI_API_KEY}`,
'Content-Type': 'application/json',
},
method: 'POST',
body: JSON.stringify({
data: {
planId,
date: new Date(),
deliveryDate: new Date(deliveryDate * 1000),
status: 1,
details,
grossPrice: totalPrice,
finalPrice: totalPrice,
subscriptionId: subscription ? strapiSubscriptionId : null,
userId,
paymentId: paymentIntent,
paymentStatus: subscription ? 'processing' : 'success',
orderInfo: [],
stripeInvoiceId: invoice,
},
}),
});
console.log('connection :', connection);
const data = await connection.json();
console.log('data :', JSON.stringify(data, null, 2));
if (connection.status !== 200) wasOrderCreated = false;
wasOrderCreated = true;
} catch (err) {
console.log('err :', err);
return false;
}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
}
]