Resolve build errors

This commit is contained in:
NeilClack
2026-07-17 11:51:14 -05:00
parent bcd216bd56
commit fd630ff714
4 changed files with 13 additions and 13 deletions
+3 -3
View File
@@ -2,9 +2,9 @@
FROM node:24-slim AS build FROM node:24-slim AS build
WORKDIR /app WORKDIR /app
# Placeholder values ONLY so `vite build` doesn't crash on $env/static/* # Placeholder values for build-time $env/static/* and better-auth's module-scope
# imports during the build step. These are NOT the real runtime values — # secret validation. These are NOT the real runtime values — App Platform
# App Platform injects the real ones as env vars when the container runs. # injects the real ones as env vars when the container runs.
ARG DATABASE_URL=postgres://placeholder:placeholder@localhost:5432/placeholder ARG DATABASE_URL=postgres://placeholder:placeholder@localhost:5432/placeholder
ARG ORIGIN=http://localhost:3000 ARG ORIGIN=http://localhost:3000
ARG BETTER_AUTH_URL=http://localhost:3000 ARG BETTER_AUTH_URL=http://localhost:3000
+2 -2
View File
@@ -1,8 +1,8 @@
import { BETTER_AUTH_URL } from '$env/static/private'; import { env } from '$env/dynamic/private';
import { sendMail } from './resend'; import { sendMail } from './resend';
export async function sendVerificationEmail(options: { email: string; token: string }) { export async function sendVerificationEmail(options: { email: string; token: string }) {
const verificationUrl = `${BETTER_AUTH_URL}/api/auth/verify-email?token=${options.token}&callbackURL=/login?verified=true`; const verificationUrl = `${env.BETTER_AUTH_URL}/api/auth/verify-email?token=${options.token}&callbackURL=/login?verified=true`;
await sendMail({ await sendMail({
to: options.email, to: options.email,
+4 -4
View File
@@ -9,9 +9,9 @@
* *
*/ */
import { Resend } from 'resend'; import { Resend } from 'resend';
import { RESEND_API_KEY, EMAIL_FROM, RESEND_TEMPLATE_ID } from '$env/static/private'; import { env } from '$env/dynamic/private';
export const resend = new Resend(RESEND_API_KEY); export const resend = new Resend(env.RESEND_API_KEY);
/** /**
* Send a transactional email using a Resend-hosted template. * Send a transactional email using a Resend-hosted template.
@@ -39,11 +39,11 @@ export async function sendMail(options: {
const { to, subject, templateId, data } = options; const { to, subject, templateId, data } = options;
const result = await resend.emails.send({ const result = await resend.emails.send({
from: EMAIL_FROM, from: env.EMAIL_FROM,
to: [to], to: [to],
subject: subject ?? 'Template Email', subject: subject ?? 'Template Email',
template: { template: {
id: templateId ?? RESEND_TEMPLATE_ID, id: templateId ?? env.RESEND_TEMPLATE_ID,
variables: data ?? {} variables: data ?? {}
} }
}); });
@@ -3,7 +3,7 @@ import { json, error } from '@sveltejs/kit';
import { auth } from '$lib/auth'; import { auth } from '$lib/auth';
import { prisma } from '$lib/db'; import { prisma } from '$lib/db';
import { sendMail } from '$lib/server/resend'; import { sendMail } from '$lib/server/resend';
import { BETTER_AUTH_URL } from '$env/static/private'; import { env } from '$env/dynamic/private';
function generateLicenseKey(): string { function generateLicenseKey(): string {
const hex = crypto.randomUUID().replace(/-/g, '').slice(0, 16).toUpperCase(); const hex = crypto.randomUUID().replace(/-/g, '').slice(0, 16).toUpperCase();
@@ -53,8 +53,8 @@ export const POST: RequestHandler = async ({ request }) => {
}); });
const verifyUrl = verification const verifyUrl = verification
? `${BETTER_AUTH_URL}/api/auth/verify-email?token=${verification.value}&callbackURL=/login?verified=true` ? `${env.BETTER_AUTH_URL}/api/auth/verify-email?token=${verification.value}&callbackURL=/login?verified=true`
: `${BETTER_AUTH_URL}/login`; : `${env.BETTER_AUTH_URL}/login`;
await sendMail({ await sendMail({
to: email, to: email,
@@ -64,7 +64,7 @@ export const POST: RequestHandler = async ({ request }) => {
firstName: name ?? email.split('@')[0], firstName: name ?? email.split('@')[0],
tempPassword, tempPassword,
verifyUrl, verifyUrl,
loginUrl: `${BETTER_AUTH_URL}/login` loginUrl: `${env.BETTER_AUTH_URL}/login`
} }
}); });
} catch (err) { } catch (err) {