inconsistent error with Cloudflare worker queues. TypeError: Can't read from request stream because

Hello guys, im currently working on a POC where i try and make a nice starter template. im currently getting this issue when trying to run my queue and read the response "TypeError: Can't read from request stream because client disconnected." i would also like to add that it works sometimes but then when i refresh it throws that error this is my code
import { Hono } from 'hono'
import { logger } from 'hono/logger'

type Environment = {
readonly MY_QUEUE: Queue<any>;
};

const app = new Hono<{
Bindings: Environment;
}>();

app.use(logger())

app.get('/', (c) => {
c.env.MY_QUEUE.send({"hello": "world"})
return c.text('Hello Hono!')
})

export default {
fetch: app.fetch,
scheduled: async (event, env, ctx) => {
// console.log("scheduled: ", event, env, ctx)
},
async queue(batch: MessageBatch, env: Environment) {
let file = "";
for (const message of batch.messages) {
console.log(message)
const error = message.body;

file += error.hello + "\n";
}

console.log(file)
},
}
import { Hono } from 'hono'
import { logger } from 'hono/logger'

type Environment = {
readonly MY_QUEUE: Queue<any>;
};

const app = new Hono<{
Bindings: Environment;
}>();

app.use(logger())

app.get('/', (c) => {
c.env.MY_QUEUE.send({"hello": "world"})
return c.text('Hello Hono!')
})

export default {
fetch: app.fetch,
scheduled: async (event, env, ctx) => {
// console.log("scheduled: ", event, env, ctx)
},
async queue(batch: MessageBatch, env: Environment) {
let file = "";
for (const message of batch.messages) {
console.log(message)
const error = message.body;

file += error.hello + "\n";
}

console.log(file)
},
}
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server