Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remix & Supabase Example possible correction #9445

Closed
ShaneC112 opened this issue Nov 14, 2023 · 1 comment · Fixed by #9448
Closed

Remix & Supabase Example possible correction #9445

ShaneC112 opened this issue Nov 14, 2023 · 1 comment · Fixed by #9448
Labels

Comments

@ShaneC112
Copy link

ShaneC112 commented Nov 14, 2023

I was following the remix example and experienced the following.

When requesting a list of less than 10 items the fetchUtils was giving a net::ERR_CONTENT_DECODING_FAILED 200 (OK) response.
When requesting a list of 11 items or more then fetchUtils was working perfectly !

I cloned the marmelab/ra-supabase example and adding a Remix app to the project it works perfectly with the example.

There appears to be a difference between a local supabase setup and using the hosted online version.

It appears the hosted Supabase adds Content-Encoding of "br" when the list is less than 10. This causes the resolution of the response.text promise within the fetchUtil to fail.

Changing the headers in the admin.api.$.tsx to specify Accept-Encoding: '' appears to resolve the issue and supabase returns the content not encoded (compressed) and the fetchUtil works.

headers: {
  prefer: request.headers.get("prefer") ?? "",
  accept: request.headers.get("accept") ?? "application/json",
  'Accept-Encoding': '',
  apiKey: `${process.env.SUPABASE_SERVICE_ROLE}`,
  Authorization: `Bearer ${process.env.SUPABASE_SERVICE_ROLE}`,
},

If there is a better alternative or fix which is usually used and the above is incorrect I'd appreciate knowing.

@erwanMarmelab erwanMarmelab self-assigned this Nov 15, 2023
@erwanMarmelab
Copy link
Contributor

reproduced, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants