SyntaxError: Unexpected end of JSON input

Any clue? I am using Qwik framework, I am not completely sure if it's happening because of better-auth itself or some Qwik setting related wiht better-auth that I did wrong.
No description
12 Replies
Nelson Sousa
Nelson SousaOP•2mo ago
I am accepting ways of debugging this It only happens in production 🤔 (http, no https or certificates) Locally against the same DB it works. hmm Also I am using an IP+port as an HOST, not sure if it is related http://ip:port/api/auth/go returns ok @bekacru do you think this could be related with better-call? 🤔
Nelson Sousa
Nelson SousaOP•2mo ago
No description
Nelson Sousa
Nelson SousaOP•2mo ago
Working directly with postman 🤔 I believe it is something related with fastify... maybe this integration is not supported yet. The request that arrives is kinda weird, no email, no password, etc
Nelson Sousa
Nelson SousaOP•2mo ago
console.log of the request...
No description
b3nab
b3nab•2mo ago
Ehy @nelsonprsousa sorry to @ you directly, but I'm in the same situation. Did you found a solution or a way to debug it? I encountered this strange error sometimes but it went away after changing some code and I didn't went deep dive on understanding the cause.. but now I have basically the same problem as you on another api. Are you using the asResponse: true flag?
Nelson Sousa
Nelson SousaOP•2mo ago
Hi @b3nab Yes, I debugged it and found out it was a problem related with content type parsers of fastify
Nelson Sousa
Nelson SousaOP•2mo ago
Since I am using Qwik framework, I opened a PR on the qwik repository (already merged) that you can check here: https://github.com/QwikDev/qwik/commit/d6e9510769de015d5b09867ff4331a05d14e1409
Nelson Sousa
Nelson SousaOP•2mo ago
In case you are using fastify with qwik, then you can just include that in your fastify-qwik.ts file I am not using asResponse: true.
b3nab
b3nab•2mo ago
interesting, thanks I will check that. I'm building a plugin to integrate better-auth into payloadcms and it's using nextjs under the hood
Nelson Sousa
Nelson SousaOP•2mo ago
Then it is probably something else 😄 You'll need to dig into that, just like I did into qwik/fastify integration
b3nab
b3nab•2mo ago
yep thanks 🙂
Nelson Sousa
Nelson SousaOP•2mo ago
np

Did you find this page helpful?