fix: tolerate empty NEXT_PUBLIC_APP_URL during production build

This commit is contained in:
Leon Serfaty
2026-06-08 04:46:58 -04:00
parent 305278a846
commit 3ad90f076f
6 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -261,7 +261,7 @@ async function generateArt(episode: EpisodeWithRelations) {
}
async function notifyReady(episode: EpisodeWithRelations) {
const appUrl = process.env.NEXT_PUBLIC_APP_URL ?? "http://localhost:3000";
const appUrl = process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000";
try {
await sendEmail({
to: episode.user.email,
+1 -1
View File
@@ -4,7 +4,7 @@ import { createAuthClient } from "better-auth/react";
import { adminClient, organizationClient } from "better-auth/client/plugins";
export const authClient = createAuthClient({
baseURL: process.env.NEXT_PUBLIC_APP_URL ?? undefined,
baseURL: process.env.NEXT_PUBLIC_APP_URL || undefined,
plugins: [adminClient(), organizationClient()],
});
+1 -1
View File
@@ -5,7 +5,7 @@ import { nextCookies } from "better-auth/next-js";
import { prisma } from "@/lib/db";
import { sendEmail, emailLayout } from "@/lib/email";
const appUrl = process.env.NEXT_PUBLIC_APP_URL ?? "http://localhost:3000";
const appUrl = process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000";
const googleConfigured = !!(process.env.GOOGLE_CLIENT_ID && process.env.GOOGLE_CLIENT_SECRET);
+1 -1
View File
@@ -2,7 +2,7 @@ import type { PlanKey } from "./plans";
const SANDBOX_BASE = "https://api-m.sandbox.paypal.com";
const base = () => process.env.PAYPAL_API_BASE ?? SANDBOX_BASE;
const appUrl = () => process.env.NEXT_PUBLIC_APP_URL ?? "http://localhost:3000";
const appUrl = () => process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000";
// Loudly warn (but don't throw — never break deploys) if PayPal is pointed at the
// sandbox while running in production. The sandbox default is fine for dev.
+1 -1
View File
@@ -18,7 +18,7 @@ export function isStripeConfigured(): boolean {
return !!process.env.STRIPE_SECRET_KEY;
}
const appUrl = () => process.env.NEXT_PUBLIC_APP_URL ?? "http://localhost:3000";
const appUrl = () => process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000";
/** Find-or-create the Stripe customer for a user and persist the id. */
export async function ensureStripeCustomer(user: {