You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And it also happens when you get the producer directly from the miniflare instance and try to send a message.
constqueue=awaitmf.getQueueProducer('CANDIDATES_QUEUE','producer')queue.send({ding: 'Hello from Miniflare!'})
Expected behavior
I expect the producer to be able to send a message to the queue and return a response.
I expect the consumer to consume the message from the queue and log out what it found.
Steps to reproduce
run the following code with npx tsx .
import{Miniflare}from'miniflare'constmf=newMiniflare({// host: '0.0.0.0',port: 5000,workers: [{name: 'producer',modules: true,routes: ['http://localhost/producer*'],script: ` export default { async fetch(req, env, ctx) { console.log('fetch') await env.CANDIDATES_QUEUE.send({ testing: 'Hello from Miniflare!', }) return new Response('Producer sent message to queue'); } } `,queueProducers: {CANDIDATES_QUEUE: 'candidates-queue',},},{name: 'consumer',modules: true,routes: ['http://localhost/queue*'],script: ` export default { async queue(batch, env) { console.log('received ' + batch.messages.length) for (let message of batch.messages) { console.log( 'message ' + message.id + ' processed: ' + JSON.stringify(message.body) ) } } } `,queueConsumers: ['candidates-queue'],},],})// this throws the network errorconstres=awaitmf.dispatchFetch('http://localhost:5000/producer')console.log(res.text())// this throws the network errorconstqueue=awaitmf.getQueueProducer('CANDIDATES_QUEUE','producer')queue.send({ding: 'Hello from Miniflare!'})
Soviut
changed the title
馃悰 BUG: Miniflare queue throwing Error: Network connection lost
馃悰 BUG: Producer sending message to queue throwing Error: Network connection lost in Miniflare
May 24, 2024
Which Cloudflare product(s) does this pertain to?
Miniflare
What version(s) of the tool(s) are you using?
3.20240512.0 [miniflare]
What version of Node are you using?
20.9.0
What operating system and version are you using?
Unbutu 22 under WSL2 on Windows 11
Describe the Bug
My producer can't send messages to my queue in miniflare.
Observed behavior
I'm testing a basic miniflare configuration with two workers and a queue. One worker is the producer, the other is the consumer.
Trying to send any messages to the queue result in the following error.
It happens when you call the producer's route (which sends a message to the queue)
And it also happens when you get the producer directly from the miniflare instance and try to send a message.
Expected behavior
I expect the producer to be able to send a message to the queue and return a response.
I expect the consumer to consume the message from the queue and log out what it found.
Steps to reproduce
run the following code with
npx tsx .
Please provide a link to a minimal reproduction
No response
Please provide any relevant error logs
The text was updated successfully, but these errors were encountered: