From 72711f758b9432644aedbad3da1f3782bfeba871 Mon Sep 17 00:00:00 2001 From: Zai Shi Date: Tue, 16 Apr 2024 09:10:50 +0200 Subject: [PATCH] await send email in signup --- .../stack-server/src/app/api/v1/auth/signup/route.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/stack-server/src/app/api/v1/auth/signup/route.tsx b/packages/stack-server/src/app/api/v1/auth/signup/route.tsx index 36a4c62f4..5cddd5a8a 100644 --- a/packages/stack-server/src/app/api/v1/auth/signup/route.tsx +++ b/packages/stack-server/src/app/api/v1/auth/signup/route.tsx @@ -13,9 +13,6 @@ import { getPasswordError } from "@stackframe/stack-shared/dist/helpers/password import { getApiKeySet, publishableClientKeyHeaderSchema } from "@/lib/api-keys"; import { StatusError } from "@stackframe/stack-shared/dist/utils/errors"; import { KnownErrors } from "@stackframe/stack-shared"; -import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises"; - -export const maxDuration = 60; const postSchema = yup.object({ headers: yup.object({ @@ -108,7 +105,11 @@ export const POST = deprecatedSmartRouteHandler(async (req: NextRequest) => { throw new KnownErrors.RedirectUrlNotWhitelisted(); } - runAsynchronously(sendVerificationEmail(projectId, newUser.projectUserId, emailVerificationRedirectUrl)); + try { + await sendVerificationEmail(projectId, newUser.projectUserId, emailVerificationRedirectUrl); + } catch (error) { + console.error(error); + } return NextResponse.json({ access_token: accessToken,