File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { env } from "~/env.server";
6
6
import type { User } from "~/models/user.server" ;
7
7
import type { AuthUser } from "./authUser" ;
8
8
import { workerQueue } from "./worker.server" ;
9
+ import { logger } from "./logger.server" ;
9
10
10
11
const client = new EmailClient ( {
11
12
apikey : env . RESEND_API_KEY ,
@@ -20,11 +21,18 @@ export async function sendMagicLinkEmail(options: SendEmailOptions<AuthUser>): P
20
21
throw redirect ( options . magicLink ) ;
21
22
}
22
23
23
- return client . send ( {
24
- email : "magic_link" ,
25
- to : options . emailAddress ,
26
- magicLink : options . magicLink ,
27
- } ) ;
24
+ logger . debug ( "Sending magic link email" , { emailAddress : options . emailAddress } ) ;
25
+
26
+ try {
27
+ return await client . send ( {
28
+ email : "magic_link" ,
29
+ to : options . emailAddress ,
30
+ magicLink : options . magicLink ,
31
+ } ) ;
32
+ } catch ( error ) {
33
+ logger . error ( "Error sending magic link email" , { error : JSON . stringify ( error ) } ) ;
34
+ throw error ;
35
+ }
28
36
}
29
37
30
38
export async function sendPlainTextEmail ( options : SendPlainTextOptions ) {
You can’t perform that action at this time.
0 commit comments