You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since actions/loaders just return a Response object, I have several cases where it would be nice to just return a fetch call directly. This way the response can stream through, which is helpful in the case where the payload is rather large, and calling await response.json() just to immediately wrap it back in a json() call seems both wasteful, and can cause out of memory errors in some environments (both on the default remix server and cloudlfare)
This works great, until the server decides to compress the response because it is large (either gzip or brotli). It shows up in my network tab correctly, with all the right encoding headers, and I can see the payload. But it seems that Remix doesn't look at this, and tries to do a JSON.parse on the encoded body.
My two options are to:
Turn off compression on the server, then it works. Or,
await the json response and convert it back to a json response again.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Since actions/loaders just return a Response object, I have several cases where it would be nice to just return a fetch call directly. This way the response can stream through, which is helpful in the case where the payload is rather large, and calling
await response.json()
just to immediately wrap it back in ajson()
call seems both wasteful, and can cause out of memory errors in some environments (both on the default remix server and cloudlfare)This works great, until the server decides to compress the response because it is large (either gzip or brotli). It shows up in my network tab correctly, with all the right encoding headers, and I can see the payload. But it seems that Remix doesn't look at this, and tries to do a JSON.parse on the encoded body.
My two options are to:
Has anyone else found another solution?
Beta Was this translation helpful? Give feedback.
All reactions