Web Dev Cody
Web Dev Cody•5mo ago

HTTP Headers Sent

I'm using convex auth with next which I'm deploying in output standalone mode deployed to a vps on railway. Whenever I click a button which calls signIn, I get this error
Error
at tk.action (/app/.next/server/middleware.js:13:41812)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ro (/app/.next/server/middleware.js:13:55155)
at async Object.handler (/app/.next/server/middleware.js:13:57545)
at async eU (/app/.next/server/middleware.js:13:24624)
at async /app/node_modules/next/dist/server/web/sandbox/sandbox.js:110:22
at async runWithTaggedErrors (/app/node_modules/next/dist/server/web/sandbox/sandbox.js:107:9)
at async NextodeServer.runMiddleware (/app/node_modules/next/dist/server/next-server.js:1062:24)
at async NextNodeServer.handleCatchallMiddlewareRequest (/app/node_moduls/next/dist/server/next-server.js:324:26)
at async NextNodeServer.handleRequestImpl (/app/node_modules/next/dist/server/base-server.js:822:28)
Error [ERR_HTTP_HEADERS_SENT]: Cannot append headers after they are sent to the client
at ServerResponse.appendHeader (node:_http_outgoing:715:11)
at /app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:24061
at _Headers.forEach (node:internal/deps/undici/undici:4354:26)
at w (/app/node_modules/nxt/dist/compiled/next-server/app-page.runtime.prod.js:16:24043)
at R (/app/node_modules/nxt/dist/compiled/next-server/app-page.runtime.prod.js:12:83072)
at nq (/app/node_modules/ext/dist/compiled/next-server/app-page.runtime.prod.js:12:69672)
at n1 (/app/node_modules/ext/dist/compiled/next-server/app-page.runtime.prod.js:12:81755)
at AsyncLocalStorage.run (node:async_hooks:346:14)
at Timeout._onTimeout (/ap/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:87775)
at listOnTimeout (node:internal/timers:581:17) {
code: 'ERR_HTTP_HEADERS_SENT',
digest: '1811456946'
}
Error
at tk.action (/app/.next/server/middleware.js:13:41812)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ro (/app/.next/server/middleware.js:13:55155)
at async Object.handler (/app/.next/server/middleware.js:13:57545)
at async eU (/app/.next/server/middleware.js:13:24624)
at async /app/node_modules/next/dist/server/web/sandbox/sandbox.js:110:22
at async runWithTaggedErrors (/app/node_modules/next/dist/server/web/sandbox/sandbox.js:107:9)
at async NextodeServer.runMiddleware (/app/node_modules/next/dist/server/next-server.js:1062:24)
at async NextNodeServer.handleCatchallMiddlewareRequest (/app/node_moduls/next/dist/server/next-server.js:324:26)
at async NextNodeServer.handleRequestImpl (/app/node_modules/next/dist/server/base-server.js:822:28)
Error [ERR_HTTP_HEADERS_SENT]: Cannot append headers after they are sent to the client
at ServerResponse.appendHeader (node:_http_outgoing:715:11)
at /app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:24061
at _Headers.forEach (node:internal/deps/undici/undici:4354:26)
at w (/app/node_modules/nxt/dist/compiled/next-server/app-page.runtime.prod.js:16:24043)
at R (/app/node_modules/nxt/dist/compiled/next-server/app-page.runtime.prod.js:12:83072)
at nq (/app/node_modules/ext/dist/compiled/next-server/app-page.runtime.prod.js:12:69672)
at n1 (/app/node_modules/ext/dist/compiled/next-server/app-page.runtime.prod.js:12:81755)
at AsyncLocalStorage.run (node:async_hooks:346:14)
at Timeout._onTimeout (/ap/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:87775)
at listOnTimeout (node:internal/timers:581:17) {
code: 'ERR_HTTP_HEADERS_SENT',
digest: '1811456946'
}
No description
7 Replies
Web Dev Cody
Web Dev CodyOP•5mo ago
No description
Web Dev Cody
Web Dev CodyOP•5mo ago
this all worked fine locally @Michal Srb any idea about this one?
Web Dev Cody
Web Dev CodyOP•5mo ago
I'm looking through the middleware code, and from what I understand, the middleware /api/auth makes a request to my actual convex deployment
No description
Web Dev Cody
Web Dev CodyOP•5mo ago
but when I try to login, I never see my convex logs print anything, so I'm guessing it doesn't get here wait... I think I had my env wrong
jamwt
jamwt•5mo ago
@Web Dev Cody working now?
Michal Srb
Michal Srb•5mo ago
NEXT_PUBLIC_CONVEX_URL must be set correctly. I'll make sure we have the right error message if it isn't.
Web Dev Cody
Web Dev CodyOP•5mo ago
railway started having issues right when I started looking into fixing this 😓 but I did notice my convex url was set incorrectly deploying now yup, it's working now 😆 basically I had a typo in this url https://lovable-elephant-19.convex.cloud which caused the middleware's proxy request to fail and print that error

Did you find this page helpful?