trentm/node-bunyan

Next.js middleware runtime not supported

davidwinter opened this issue · 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.

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.

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

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