Compare commits

...

2 Commits

Author SHA1 Message Date
Claude
2139f1ac6c Use siteConfig instead of NEXT_PUBLIC_APP_URL for root layout metadata
The metadata in the root layout referenced process.env.NEXT_PUBLIC_APP_URL
with non-null assertions, but this env var is not guaranteed to be set
(only .env.example exists). This caused `new URL(undefined)` to throw
during SSR, resulting in a blank page on /create (and all other routes).

Replace all NEXT_PUBLIC_APP_URL references in metadata with siteConfig.url
and siteConfig.ogImage, which are already defined and used elsewhere in
the same metadata block.

https://claude.ai/code/session_01Ez3f6QxR3MxNq6YfAeqrcH
2026-03-18 15:44:56 +00:00
Claude
85cceaa7a9 Fix blank /create page by handling missing NEXT_PUBLIC_APP_URL env var
`new URL(process.env.NEXT_PUBLIC_APP_URL!)` in the root layout throws
"TypeError: Invalid URL" during SSR when the env var is not set (no .env
file, only .env.example exists), causing the entire page to return a 500
with an empty body. Fall back to http://localhost:4000 when the var is
undefined.

https://claude.ai/code/session_01Ez3f6QxR3MxNq6YfAeqrcH
2026-03-18 15:37:46 +00:00

View File

@@ -20,7 +20,7 @@ export const metadata: Metadata = {
default: siteConfig.name,
template: `%s - ${siteConfig.name}`,
},
metadataBase: new URL(process.env.NEXT_PUBLIC_APP_URL!),
metadataBase: new URL(siteConfig.url),
description: siteConfig.description,
keywords: ["Next.js", "React", "Tailwind CSS", "Components", "shadcn"],
authors: [
@@ -33,13 +33,13 @@ export const metadata: Metadata = {
openGraph: {
type: "website",
locale: "en_US",
url: process.env.NEXT_PUBLIC_APP_URL!,
url: siteConfig.url,
title: siteConfig.name,
description: siteConfig.description,
siteName: siteConfig.name,
images: [
{
url: `${process.env.NEXT_PUBLIC_APP_URL}/opengraph-image.png`,
url: siteConfig.ogImage,
width: 1200,
height: 630,
alt: siteConfig.name,
@@ -50,7 +50,7 @@ export const metadata: Metadata = {
card: "summary_large_image",
title: siteConfig.name,
description: siteConfig.description,
images: [`${process.env.NEXT_PUBLIC_APP_URL}/opengraph-image.png`],
images: [siteConfig.ogImage],
creator: "@shadcn",
},
icons: {