<@498057949541826571> Getting this error on trying...
# general
k
@rp_st Getting this error on trying to login : { "statusCode": 500, "message": "SuperTokens core threw an error for a GET request to path: '/public/users/by-accountinfo' with status code: 504 and message: \r\n504 Gateway Time-out\r\n\r\n504 Gateway Time-out\r\n\r\n\r\n", "timestamp": "2024-01-19T07:46:59.841Z" }
r
Hey. Are you using self hosted or managed service?
k
self hosted
r
then it's an issue related to your infra
not sure i can help here
ask your devops team please
k
yesterday we migrated over 1 lakh users So it can cause this issue right ?
r
well.. not sure
i dont know anything about your setup
so hard to say
k
Is there any alternate of this method : I am getting 504 due to this as I have over 60000 users Can this be done in O(1) I want to check for single instance and return
r
Yea. It can.
k
I am using this here Weirdly It is working for new users but for existing it stucks and gives 504
Can you please tell how
r
The core never returns a 504. It’s probably something to do with your infra. Not sure
k
We have already increased the cpu limit to 8 gb And no other instance is running I am testing this only on develop On commenting out this method it works
This issue occured after we migrated 50k + users yesterday Probably something wrong with the method , please provide any alternate method for testing
?
hi @rp_st Please respond to the query I am unable to login due to postConsumeCode method where user is fetched
Your query has some issue in fetching single user when the size of users increases
It is taking over 1 minute then TLE
r
Check your self hosted config. Number of connections etc.
Or else move to the managed fire service. Hard for me to help
Since it’s self hosted.
k
Are you sure it is due self hosted and your code is OK and able to handle millions of users without TLE ?
r
Yea for sure. We already have users with several millions of users and migration has been done for them in the same way as you are doing
Which specific query is taking time?
Also, which version of the core are you using?
k
SELECT au.user_id, au.primary_or_recipe_user_id, au.is_linked_or_is_a_primary_user, au.recipe_id, aaru.tenant_id, aaru.time_joined FROM app_id_to_user_id as au LEFT JOIN all_auth_recipe_users as aaru ON au.app_id = aaru.app_id AND au.user_id = aaru.user_id WHERE au.primary_or_recipe_user_id IN (SELECT primary_or_recipe_user_id FROM app_id_to_user_id WHERE (user_id IN ($1) OR au.primary_or_recipe_user_id IN ($2)) AND app_id = $3) AND au.app_id = $4 It is for getting User based on tenantId and accountInfo
r
@sattvikc
k
?
Latest release
s
I am looking into it, will get back soon
r
@krrishan you are using passwordless login right?
k
This is error screenshot for refernce
yes Actually both For signup we are using passwordless login
r
Ok thanks
Also, which database? MySQL of psql?
k
Psql
s
hey @krrishan could you try using the latest version of core?
registry.supertokens.io/supertokens/supertokens-postgresql:7.0
do not used any cached image of it, please pull the latest image
k
trying
Is it correct link ?
s
that's the docker image name, not a link
I suppose you are self hosting with docker right ?
k
got it trying with it
r
U may have to run some db migrations? @sattvikc ?
s
yes, depending on version of core currently running
r
What’s the version of the core you are running @krrishan ?
@sattvikc please provide a command to know the version of the core.
s
docker exec <containerId> supertokens --version
you can get the container id using
docker ps
k
with new image it is working
can you please explain the issue though?
s
there was a bug in older version of core, which was fixed long ago
r
We thought u were using the latest version. Which is why we didn’t bring it up.
But anyway, glad it got sorted
k
ok
thankyou
/auth/signinup/code is also giving 504 frequently as user count increases in uat
r
That just means there is a timeout error. Cause of slow response.
k
Yes it is happening as supertoken checks for existing user . Ideally there should be some indexing to get the response faster
r
Yes. We are investigating that.
The screenshot you provided helped
Are you doing any user id mapping in your code?
k
Yes while migrating the users
r
Ok
k
One thing I noticed the external id is stored somewhere else and does not replace the supertoken generated id in the user table
r
yea, thats intentional.
hey @krrishan run the following query in your database and then see if it improves. Keep in mind that running this query will also take sometime as it's going to index lots of rows.. so wait for it to finish:
Copy code
CREATE INDEX userid_mapping_supertokens_user_id_index ON userid_mapping (supertokens_user_id);
k
Hi @rp_st the index is already there
Can you please check
r
5 mins
try this:
Copy code
CREATE INDEX userid_mapping_supertokens_user_id_without_app_id_index ON userid_mapping (supertokens_user_id);
k
I think it is helping thanks
Will give you final update by eod
r
great!
it will definitely help. But not sure if it will solve the whole problem. If it doesn't lmk please, and please share the same screenshot for sql queries you had last time.
k
Sure thanks It is working for now
r
nice!
4 Views