fix(auth): remove ssl enforcement in prod for supabase db

This commit is contained in:
Waleed Latif
2025-02-16 17:33:25 -08:00
parent bd4168c55d
commit 3b1788a469
2 changed files with 22 additions and 14 deletions
-1
View File
@@ -8,6 +8,5 @@ const connectionString = process.env.POSTGRES_URL || process.env.DATABASE_URL!
// Disable prefetch as it is not supported for "Transaction" pool mode
const client = postgres(connectionString, {
prepare: false,
ssl: process.env.NODE_ENV === 'production',
})
export const db = drizzle(client)
+22 -13
View File
@@ -25,19 +25,6 @@ export const auth = betterAuth({
emailAndPassword: {
enabled: true,
requireEmailVerification: true,
sendVerificationEmail: async ({ user, url }: EmailHandler) => {
await resend.emails.send({
from: 'Sim Studio <onboarding@simstudio.ai>',
to: user.email,
subject: 'Verify your email',
html: `
<h2>Welcome to Sim Studio!</h2>
<p>Click the link below to verify your email:</p>
<a href="${url}">${url}</a>
<p>If you didn't create an account, you can safely ignore this email.</p>
`,
})
},
sendResetPassword: async ({ user, url }: EmailHandler) => {
await resend.emails.send({
from: 'Sim Studio <team@simstudio.ai>',
@@ -52,6 +39,28 @@ export const auth = betterAuth({
})
},
},
emailVerification: {
sendVerificationEmail: async ({ user, url }: EmailHandler) => {
console.log('Attempting to send verification email to:', user.email)
console.log('Verification URL:', url)
try {
const result = await resend.emails.send({
from: 'Sim Studio <onboarding@simstudio.ai>',
to: user.email,
subject: 'Verify your email',
html: `
<h2>Welcome to Sim Studio!</h2>
<p>Click the link below to verify your email:</p>
<a href="${url}">${url}</a>
<p>If you didn't create an account, you can safely ignore this email.</p>
`,
})
console.log('Resend API response:', result)
} catch (error) {
console.error('Error sending verification email:', error)
}
},
},
socialProviders: {
github: {
clientId: process.env.GITHUB_CLIENT_ID!,