auth-js icon indicating copy to clipboard operation
auth-js copied to clipboard

`Authorization: Bearer` wrong key for PATCH with Cypress

Open solvemon opened this issue 2 years ago • 4 comments

Bug report

Describe the bug

This is a bit of a weird bug that I am encountering after upgrading supabase-js from 1.27.0 to 1.31.1.

I am not sure if I am able to reproduce this, so let me try to explain instead.

I have a set of Cypress tests running on my supabase front-end, and after upgrading SupabaseJS, they started failing. Tests are failing because any PATCH-calls are receiving a 404 from the backend. image

By inspecting the network calls in Cypress, I can see that there is something weird with the Authorization-header: It is using the API-token instead of the Access/refresh token! Consider the Authorization-header for the successful GET-call: image

and compare it to the failing PATCH-call: image

Running the exact same operation through the browser (Firefox in this case): image

Some further details:

  • only PATCH-calls are failing with 404, not GET
  • the PATCH calls are only failing in Cypress. When I run through the same steps manually in a browser, it works as expected
  • This started only after upgrading supabase-js from 1.27.0 to 1.31.1

Any idea if this is something I'm doing wrong? Or maybe it's not an issue with Supabase but with Cypress? Any hints or pointers would be greatly appreciated!

System information

  • OS: Linux 5.13.19-2
  • Version of supabase-js: 1.31.1
  • Version of Node.js: 16.13.0

EDIT: I have narrowed down the problem to the change in supabase-js from 1.27.0 to 1.28.0: https://github.com/supabase/supabase-js/compare/v1.27.0...v1.28.0

solvemon avatar Mar 08 '22 08:03 solvemon

Did you find any solutions to this? I'm having the same problem and downgrading doesn't do it for me..

perhp avatar Mar 26 '22 05:03 perhp

Did you find any solutions to this? I'm having the same problem and downgrading doesn't do it for me..

Unfortunately no, and I am still unable to upgrade past 1.27.0

solvemon avatar Mar 26 '22 07:03 solvemon

We are experiencing a similar issue.

EDIT - This looks like our issue: https://github.com/supabase/supabase/discussions/6080

psteinroe avatar Apr 04 '22 14:04 psteinroe

EDIT: I have narrowed down the problem to the change in supabase-js from 1.27.0 to 1.28.0: https://github.com/supabase/supabase-js/compare/v1.27.0...v1.28.0

@kangmingtay FYI, seems there was a regression in gotrue-js ^

steve-chavez avatar Apr 04 '22 18:04 steve-chavez

Hey everyone, just checking, is this still an issue if you update to the latest supabase/js verison?

kangmingtay avatar Sep 30 '22 05:09 kangmingtay

I haven't had this issue for a long time now, so my gut feeling would be that this have been resolved by the new versions. 👍

perhp avatar Oct 03 '22 07:10 perhp