My API stopped working CF - Error: unexpected end of file, BrotliDecoder.zlibOnErro

Hey there,

I am front end on Vercel and backend on Railway with unified domain and the domain is on Cloudflare.

Without any code changes, my API in backend stopped working, all of them… axios request are failing and I have no idea why but from the log I am getting this:
cause: Error: unexpected end of file
at BrotliDecoder.zlibOnError [as onerror] (node:zlib:189:17) {
errno: -5,
code: ‘Z_BUF_ERROR’
}
}
This is one of the APIS: https://api.xfrens.xyz/collections/most-followed

when accessing it directly from browser, it responds correclty but from my front end, it shows the weird error… and I cound’t even find Brotli settings (I used to see it in cloudflare).

Could you please help me

Ok I fixed it by adding compression to my package in backend and calling: app.use(compression() as express.RequestHandler);

but I would like to understand why it broke at the first place… I didn’t change any configuration

Most likely this:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.