Long delay after logging in with Apple (white screen)

It works but it causes quite a delay. What can I do to fix this? auth.ts
apple: {
clientId: import.meta.env.VITE_AUTH_APPLE_ID as string,
clientSecret: import.meta.env.VITE_AUTH_APPLE_SECRET as string,
scope: ["email", "name"],
mapProfileToUser: (profile) => {
return {
name: profile.email.split("@")[0],
providerId: "apple",
};
},
},
apple: {
clientId: import.meta.env.VITE_AUTH_APPLE_ID as string,
clientSecret: import.meta.env.VITE_AUTH_APPLE_SECRET as string,
scope: ["email", "name"],
mapProfileToUser: (profile) => {
return {
name: profile.email.split("@")[0],
providerId: "apple",
};
},
},
apple-auth-button.tsx
await signIn.social({
provider: "apple",
errorCallbackURL: PATHS.AUTH_ERROR, // url to redirect if an error occurs during the sign in process
newUserCallbackURL: `${PATHS.DASHBOARD}?isNewUser=true`,
callbackURL: PATHS.DASHBOARD,
});
await signIn.social({
provider: "apple",
errorCallbackURL: PATHS.AUTH_ERROR, // url to redirect if an error occurs during the sign in process
newUserCallbackURL: `${PATHS.DASHBOARD}?isNewUser=true`,
callbackURL: PATHS.DASHBOARD,
});
8 Replies
bekacru
bekacru3w ago
make sure to index your db fields
RadiantFrog
RadiantFrogOP2w ago
The db is convex, only 2 rows in it. Every other request is fast. It was also this slow when using auth.js I dont think this is a db performance issue. do you know why the screen is white? My app's rendering is super fast. @bekacru I've added the indexes on the collections and added the cookie cache, but it's unfortunately not any faster. Do you have any other suggestions? Thanks for the help so far!
bekacru
bekacru2w ago
try to check where the latency is coming from. see the db logs if it's slow because of db queries. Other than db query, from better auth server side there shouldn't be anything that signficant. Try to see if any other thing is going on, in the client side.
RadiantFrog
RadiantFrogOP2w ago
Its these 3 requests taking together more than 2.5 seconds.
No description
RadiantFrog
RadiantFrogOP2w ago
https://progressmade.ai/api/auth/subscription/list https://progressmade.ai/api/auth/get-session https://progressmade.ai/api/auth/subscription/list I've had to remove the caching on the session, because it would not allow the user to update the profile and see the result But the list call is made twice and takes a very long time.
RadiantFrog
RadiantFrogOP2w ago
The server is in my region. I see that email auth also takes 2 seconds.
No description
RadiantFrog
RadiantFrogOP2w ago
However only for Apple you see a white screen, before it's rendering the
callbackURL
callbackURL

Did you find this page helpful?