#vercel deploy error

1 messages · Page 1 of 1 (latest)

arctic rose
#

hi there....
pnpm build command successfully builds but when i deploy on vercel i get this error

Error 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
dire terraceBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

arctic rose
#

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(/\/$/, ''),
};