Using Worker in app router?
Unanswered
Southern African anchovy posted this in #help-forum
Southern African anchovyOP
I am trying to use Worker in app router (POST request), but it seems like it does exactly nothing. Is there some flag, or perhaps some limitation I need to be aware of in Next.js? Thanks
7 Replies
Southern African anchovyOP
Basically I am just trying to do this:
var Worker = require("web-worker")
const worker = new Worker(data:application/javascript,postMessage(42));
worker.addEventListener('message', e => {
console.log("HAAAAAALLLLLOOOOOO! " + e.data) // "200 OK"
});
worker.postMessage('hello');inside a
export async function POST(request: NextRequest) {it works in pure node js it seems:
Southern African anchovyOP
If anyone is curious about this I've posted an issue here with steps to repro: https://github.com/vercel/next.js/issues/57330