trentm / node-bunyan

a simple and fast JSON logging module for node.js services
Other
7.15k stars 513 forks source link

Next.js middleware runtime not supported #717

Open davidwinter opened 8 months ago

davidwinter commented 8 months ago

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 commented 8 months ago

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.

PauMateu commented 7 months ago

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

rgembalik commented 5 months ago

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

chris-aeviator commented 2 days ago

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