node-bunyan icon indicating copy to clipboard operation
node-bunyan copied to clipboard

Next.js middleware runtime not supported

Open davidwinter opened this issue 1 year ago • 4 comments

It doesn't seem as though bunyan supports the Node.js middleware runtime. It's a bit of a quirky one, as it's not Node.js nor a strict browser environment.

https://nextjs.org/docs/pages/api-reference/edge

It should be fine, if it is detectable somehow, for the middleware edge runtime to just use the browser version.

davidwinter avatar Nov 04 '23 11:11 davidwinter

Can we change this line to check for global or globalThis instead of just window?

https://github.com/trentm/node-bunyan/blob/master/lib/bunyan.js#L55

Though in fact, window still doesn't exist on globalThis in the middleware as it's an edge runtime.

davidwinter avatar Nov 04 '23 12:11 davidwinter

Hi, we are facing the same issue, any news on how to solve this?

PauMateu avatar Nov 13 '23 11:11 PauMateu

Same problem here - I would love to see some way of actually overriding the environment, or detect next as a separate one.

rgembalik avatar Jan 17 '24 15:01 rgembalik

this seems to be a common theme https://github.com/pinojs/pino/issues/1909

chris-aeviator avatar Jul 01 '24 13:07 chris-aeviator