S
SolidJS2mo ago
gsoutz

Invalid Frame Header only on production build websockets

I wrote this simple tutorial, only to realize it's a minimum reproducible example that demonstrates the bug: Steps to Reproduce:
git clone https://github.com/eguneys/solidstart-websockets-chat-tutorial

pnpm install
pnpm build

node ./output/server/index.mjs
git clone https://github.com/eguneys/solidstart-websockets-chat-tutorial

pnpm install
pnpm build

node ./output/server/index.mjs
Look at the websocket connection in the network tab, see it breaks with this error: Invalid Frame Header. But if you run, pnpm dev The error is gone. Please fix this "very" obscure error asap, or it's a very shame as I produced it very quickly while writing my tutorial.
1 Reply
gsoutz
gsoutzOP2mo ago
I think I have found the problem. Sorry just getting used to this SSR thing. Probably I need to tell that WebSocket client is clientSide only code. I seen some documentation where functions are named clientOnlySocketProvider, like that. I will try that tomorrow. If any of you have a further suggestion feel free to let me know. Guys, I've found the problem, export async function GET(event: APIEvent) { let request = event.nativeEvent.node.req let { path } = event.params await handleUpgrade(request) return undefined } this Route API is returning something to the client even though I handle the upgrade myself. So if I put a delay before this function returns the Invalid Frame Header error is delayed. So my question is, how do I make a Router API not to return anything or do anything weird, because I am handling the upgrade myself.
Want results from more Discord servers?
Add your server