mcansh/remix-fastify

Cannot set headers after they are sent to the client

Closed this issue · 3 comments

Hi.

I'm using remix-fastify with streaming hydration, and sometimes I got this error:

Error: Cannot set headers after they are sent to the client
    at new NodeError (node:internal/errors:393:5)
    at ServerResponse.setHeader (node:_http_outgoing:644:11)
    at ServerResponse.writeHead (node:_http_server:377:21)
    at onSendEnd (node_modules/fastify/lib/reply.js:598:7)
    at onSendHook (node_modules/fastify/lib/reply.js:529:5)
    at fallbackErrorHandler (node_modules/fastify/lib/error-handler.js:130:3)
    at handleError (node_modules/fastify/lib/error-handler.js:60:5)
    at onErrorHook (node_modules/fastify/lib/reply.js:699:5)
    at _Reply.Reply.send (node_modules/fastify/lib/reply.js:133:5)
    at defaultErrorHandler (node_modules/fastify/lib/error-handler.js:91:9)

My server file is identical to the example/server.js, my entry.server.ts file is like this

hm, to my knowledge i don't think i've seen this, but i'll keep an eye out for it

alright got it to happen if i spam refresh the page - i'll try and see what's up with it

This still happens on v2.2.1 @mcansh