fix: initialize Resend lazily to prevent test failures when API key is absent
This commit is contained in:
parent
90b0890263
commit
531da98c24
1 changed files with 2 additions and 1 deletions
|
|
@ -4,7 +4,6 @@ import { Resend } from "resend";
|
||||||
import { db } from "@lila/db";
|
import { db } from "@lila/db";
|
||||||
import * as schema from "@lila/db/schema";
|
import * as schema from "@lila/db/schema";
|
||||||
|
|
||||||
const resend = new Resend(process.env["RESEND_API_KEY"]);
|
|
||||||
const emailFrom = process.env["EMAIL_FROM"] ?? "noreply@lilastudy.com";
|
const emailFrom = process.env["EMAIL_FROM"] ?? "noreply@lilastudy.com";
|
||||||
|
|
||||||
export const auth = betterAuth({
|
export const auth = betterAuth({
|
||||||
|
|
@ -30,6 +29,7 @@ export const auth = betterAuth({
|
||||||
user: { email: string };
|
user: { email: string };
|
||||||
url: string;
|
url: string;
|
||||||
}) => {
|
}) => {
|
||||||
|
const resend = new Resend(process.env["RESEND_API_KEY"]);
|
||||||
await resend.emails.send({
|
await resend.emails.send({
|
||||||
from: emailFrom,
|
from: emailFrom,
|
||||||
to: user.email,
|
to: user.email,
|
||||||
|
|
@ -48,6 +48,7 @@ export const auth = betterAuth({
|
||||||
user: { email: string };
|
user: { email: string };
|
||||||
url: string;
|
url: string;
|
||||||
}) => {
|
}) => {
|
||||||
|
const resend = new Resend(process.env["RESEND_API_KEY"]);
|
||||||
await resend.emails.send({
|
await resend.emails.send({
|
||||||
from: emailFrom,
|
from: emailFrom,
|
||||||
to: user.email,
|
to: user.email,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue