Good morning, I've added recently email verification to my app. However now one the user first loads...
d
Good morning, I've added recently email verification to my app. However now one the user first loads the page, the verify call takes like 6 seconds, also it calls the verify email api 2. Im pretty sure im doing something incorrectly šŸ˜…
r
hey @drixhua
are you self hosting the core?
and are both of these GET calls? Or is one of them OPTIONS?
d
yes, im hosting it with docker
r
right. So you might want to see what is the slow part - the core or the backend process running the backend SDK
d
bot GET requests
r
are you on react dev build with strict mode?
d
yes, strict mode
r
can you remove the strict mode? Or then try in a production build? Maybe the 2 calls to verify won't happen then
d
Indeed, thank you I will try
Yes, that fixed it šŸ‘
r
awesome!
about the slow response times. Is that only happening for this API? Or others too?
d
I think for the signup is also taking a while
r
Right. One quick test you could do is to connect your backend to our managed service and see if it’s still slow. If it is, then the issue is your backend process (that’s running our backend SDK). Else it’s on the core you are running.
d
Hi, I switched to manage service and now seems to load quite fast. Do you know how I can debugg my docker container to see what's wrong? Thank you
r
Check the RAM / CPU cores available. We recommend giving 500 mb ram and 2 CPU cores for great performance. Issues could also be if you are on apple m1 / m2 acrhitecture and have docker or the db thats not natively built for ARM. I suggest using a cloud service instead of your local machine to run the core.
d
I was using 512mb ram and 1CPU and changed now to 4gb ram and 1 CPU was is taking still around 7 s to complete the sign in request
r
hmm. Try deplpoying on an ec2 instance?
Not sure what the problem could be.. cause our SaaS uses the exact same core (same docker image even)
could be your db as well which is slow. Try running with in memory db and see if that speeds things up. If it does, then the db is the issue.
d
thank you, will try
for what I see in the database logs, this is the query that is taking takes the longest
INSERT INTO app_id_to_user_id(app_id, user_id, primary_or_recipe_user_id, recipe_id) VALUES($1, $2, $3, $4) - Execution Time: 6.238697 milliseconds
r
right
so it's something with the db
can you delete the db and restart the core and see if it makes a diff?
d
mmm still taking to long
Im hosting the docker in digital ocean if that helps
r
Is it the same query that’s taking time? Where is the db hosted? And where was it hosted before when the query took 6 seconds?
d
yes, the same query, the db is hosted in digital ocean and was also hosted there before
r
Could you try another db?
d
sorry, what do you mean by trying another db?
r
That’s not hosted on digital ocean
d
I could create one in AWS yes
Hi, i still wasnt able to fix this issue, Ive tried creating a db in aws, change the resources for the core, but is working only fast on Managed Service. I was wondering if I have some env vars missing in my core config maybe?
r
Doesn’t seem to be missing anything
I’m not sure why this would be happening without having access to your setup. Have you tried consulting the cloud hosting provider?
d
Checking the database logs for the signinup request it shows this error. Maybe is related?
Copy code
2023-12-24 15:52:28 UTC::@:[398]:LOG:  checkpoint starting: time
2023-12-24 15:52:28 UTC::@:[398]:LOG:  checkpoint complete: wrote 2 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.108 s, sync=0.003 s, total=0.113 s; sync files=2, longest=0.002 s, average=0.002 s; distance=65484 kB, estimate=65561 kB
2023-12-24 15:54:13 UTC:64.226.88.158(46770):postgres@supertokens:[8158]:ERROR:  duplicate key value violates unique constraint "thirdparty_user_to_tenant_third_party_user_id_key"
2023-12-24 15:54:13 UTC:64.226.88.158(46770):postgres@supertokens:[8158]:DETAIL:  Key (app_id, tenant_id, third_party_id, third_party_user_id)=(public, public, google, 106204688582746280271) already exists.
2023-12-24 15:54:13 UTC:64.226.88.158(46770):postgres@supertokens:[8158]:STATEMENT:  INSERT INTO thirdparty_user_to_tenant(app_id, tenant_id, user_id, third_party_id, third_party_user_id) VALUES($1, $2, $3, $4, $5)
2023-12-24 15:54:14 UTC:64.226.88.158(46770):postgres@supertokens:[8158]:ERROR:  duplicate key value violates unique constraint "emailverification_verified_emails_pkey"
2023-12-24 15:54:14 UTC:64.226.88.158(46770):postgres@supertokens:[8158]:DETAIL:  Key (app_id, user_id, email)=(public, 240ad2d3-7c2e-47ab-b6bc-31e0aa7938d6, asdsad@gmail.com) already exists.
2023-12-24 15:54:14 UTC:64.226.88.158(46770):postgres@supertokens:[8158]:STATEMENT:  INSERT INTO emailverification_verified_emails(app_id, user_id, email) VALUES($1, $2, $3)
r
That’s all ok.
Are you using ec2 instance to the run core?
d
no, the core is running in digital ocean as a docker container
r
Hmm.
d
the database is in aws
r
Im not sure why this would be happening honestly
I would need access to your infra to help
You should consult someone at digital ocean maybe
d
Allright, no worries
Ill contact them
Thank you
r
Yup. If you find anything specifically wrong with supertokens, let us know. We can of course help with that
13 Views