Ali Azlan
Node.js does not work in Next.js
My hono implementation works fine on edge in Next.js. But, I am getting the following error when migrating from edge (hono/vercel) to nodejs (@hono/node-server/vercel).
(Continued in thread)
⨯ TypeError: outgoing.writeHead is not a function
at responseViaResponseObject (webpack-internal:///(rsc)/./node_modules/@hono/node-server/dist/vercel.mjs:373:14)
at eval (webpack-internal:///(rsc)/./node_modules/@hono/node-server/dist/vercel.mjs:416:14)
at node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:53452
at node_modules/next/dist/server/lib/trace/tracer.js:140:36
at NoopContextManager.with (node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js:25:19)
at ContextAPI.with (node_modules/@opentelemetry/api/build/src/api/context.js:60:46)
at NoopTracer.startActiveSpan (node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js:65:31)
at ProxyTracer.startActiveSpan (node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js:36:24)
at node_modules/next/dist/server/lib/trace/tracer.js:122:103
at NoopContextManager.with (node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js:25:19)
at ContextAPI.with (node_modules/@opentelemetry/api/build/src/api/context.js:60:46)
at NextTracerImpl.trace (node_modules/next/dist/server/lib/trace/tracer.js:122:28)
at node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:46261
at AsyncLocalStorage.run (node:async_hooks:346:14)
at Object.wrap (node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:39188)
at node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:45368
at AsyncLocalStorage.run (node:async_hooks:346:14)
at Object.wrap (node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:37583)
at node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:45330
⨯ TypeError: outgoing.writeHead is not a function
at responseViaResponseObject (webpack-internal:///(rsc)/./node_modules/@hono/node-server/dist/vercel.mjs:373:14)
at eval (webpack-internal:///(rsc)/./node_modules/@hono/node-server/dist/vercel.mjs:416:14)
at node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:53452
at node_modules/next/dist/server/lib/trace/tracer.js:140:36
at NoopContextManager.with (node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js:25:19)
at ContextAPI.with (node_modules/@opentelemetry/api/build/src/api/context.js:60:46)
at NoopTracer.startActiveSpan (node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js:65:31)
at ProxyTracer.startActiveSpan (node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js:36:24)
at node_modules/next/dist/server/lib/trace/tracer.js:122:103
at NoopContextManager.with (node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js:25:19)
at ContextAPI.with (node_modules/@opentelemetry/api/build/src/api/context.js:60:46)
at NextTracerImpl.trace (node_modules/next/dist/server/lib/trace/tracer.js:122:28)
at node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:46261
at AsyncLocalStorage.run (node:async_hooks:346:14)
at Object.wrap (node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:39188)
at node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:45368
at AsyncLocalStorage.run (node:async_hooks:346:14)
at Object.wrap (node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:37583)
at node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:45330
3 replies