Hi, Our application is suddenly getting CORS error...
# ask-a-descoper
b
Hi, Our application is suddenly getting CORS error to api.descope.com
s
have you changed settings ?
b
None
s
send me in DM your project ID
b
Now It works a bit and then errors again
s
can you paste exact error you get ?
also what configs you have here ?
Looping in @orange-belgium-27264 @rapid-doctor-25622
o
hi @brave-flower-58422 please share the full error, specifically of the OPTIONS request
looks like you’re getting rate limited, are you automating something? can you provide more details on your application?
s
seems you are calling
Copy code
/v1/auth/refresh
in very high rate, like 4-5 times a sec
b
Thanks, checking this
For some reason, it seems that our application attempted to many refreshes as you said. The weird thing is that it's happening on a specific workstation (??) • Both chrome and firefox • Both dev and prod Another thing is that it also happens in descope's site. Do you have any advice?
s
all of them seem to use the React SDK @great-diamond-35515 maybe you have an idea why refresh could create many calls in rapid pace?
g
hey 👋 It will be helpful to see the code that reproduce this do you perhaps have any sample code that can reproduce this behavior? let me know if a call would help
b
again, it happens in app.descope.com too
not my code
s
@brave-flower-58422 have you tried to clear all cookies ?
g
fyi it doesn’t happen to me when I visit app.descope.com maybe there is an extension related? also, like Meir recommended, lets try to remove cookies
b
again - It happens to me on a specific workstation. I have confirmed that when i access to both my site and descope's site it's ok on different machines
s
plz try to remove cookies from both app.descope.com and your sites
b
clearing the cookies worked
thanks
(btw clearing the local storage beforehand didn't have any effect)
👍 1
is there any reason you can think of why i reached this state?
g
no idea, only hypothesis, butmaybe something crashed in the application that cause this to re-trigger? (was there any console errors/network errors?) I will try to reproduce this locally
s
one idea maybe, is the cookie domain the same for both your dev and prod apps ?
b
I assume it is since we didn't specify anything regarding this. Also, we use the same project id when developing for now. Is that what you meant?
Anyway this sounds reasonable. Thank you for the help!
s
same project for 2 apps might explain this, let us check/replicate this locally
b
@square-vr-55083 @great-diamond-35515 bringing this back up... I still got the issue repeatedly - I think I understand the issue. My workstation is a bit new and customized - still hadn't have the chance to properly set the system time properly. Therefore, it causes an issue when calculating the time for the next refresh time at [1]. [1] https://github.com/descope/descope-js/blob/a86a00483cd0c612dc21871f619fb5299b9d3a73/packages/web-js-sdk/src/enhancers/withAutoRefresh/helpers.ts#L19
Because my system time is a few hours ahead, I get that the
timeout
variable at [2] is negative, effectively causes continuous refreshes at all sites using the web-js-sdk. [2] https://github.com/descope/descope-js/blob/a86a00483cd0c612dc21871f619fb5299b9d3a73/packages/web-js-sdk/src/enhancers/withAutoRefresh/index.ts#L54
s
Ohh, I see now
b
I wouldn't consider this a bug ofcourse, but perhaps add a but of minmum bounds on the timeout..
s
We will try to look if we can identify this in future, and return q better error msg
We do give some buffer of time, but not for hours gap
b
sure