vercel deploy error
Answered
Giant Angora posted this in #help-forum
Giant AngoraOP
hi there....
pnpm build
command successfully builds but when i deploy on vercel i get this errorError occurred prerendering page "/_not-found". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Invalid URL
at new URL (node:internal/url:818:25)
at Module.f (/vercel/path0/.next/server/chunks/354.js:1:8410)
at /vercel/path0/.next/server/chunks/159.js:29:128832
at /vercel/path0/.next/server/chunks/865.js:2:24025
at a.with (/vercel/path0/.next/server/chunks/865.js:1:12619)
at u.with (/vercel/path0/.next/server/chunks/865.js:1:6819)
at u.startActiveSpan (/vercel/path0/.next/server/chunks/865.js:1:21874)
at a.startActiveSpan (/vercel/path0/.next/server/chunks/865.js:1:22408)
at /vercel/path0/.next/server/chunks/865.js:2:23533
at a.with (/vercel/path0/.next/server/chunks/865.js:1:12619)
Export encountered an error on /_not-found/page: /_not-found, exiting the build.
⨯ Static worker exited with code: 1 and signal: null
ELIFECYCLE Command failed with exit code 1.
Error: Command "pnpm run build" exited with 1
Answered by Giant Angora
i have solved this... actually i used system exposed variables and vercel mentioned there "protocol is not included". i used siteUrl in
new URL
contructor and this was throwing error.import { publicEnvVars } from './public-env-vars';
export const siteConfig = {
name: publicEnvVars.SITE_NAME,
siteUrl: (
(process.env.NEXT_PUBLIC_VERCEL_ENV === 'production' &&
`https://${process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL}`) ||
(process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview' &&
`https://${process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL}`) ||
`http://localhost:3000`
).replace(/\/$/, ''),
};
1 Reply
Giant AngoraOP
i have solved this... actually i used system exposed variables and vercel mentioned there "protocol is not included". i used siteUrl in
new URL
contructor and this was throwing error.import { publicEnvVars } from './public-env-vars';
export const siteConfig = {
name: publicEnvVars.SITE_NAME,
siteUrl: (
(process.env.NEXT_PUBLIC_VERCEL_ENV === 'production' &&
`https://${process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL}`) ||
(process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview' &&
`https://${process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL}`) ||
`http://localhost:3000`
).replace(/\/$/, ''),
};
Answer