vercel / next-learn

Learn Next.js Starter Code
https://next-learn-dashboard.vercel.sh/
MIT License
3.96k stars 1.95k forks source link

# Unable to set up the vercel environment during deploying the site. #771

Open jajos12 opened 5 months ago

jajos12 commented 5 months ago

When I after following every instruction I ran vercel from the cli, I also I have tried from the vercel website but it says that it is having a problem the problem log is as follows :

 Creating an optimized production build ...

✓ Compiled successfully ✓ Linting and checking validity of types Collecting page data .tl [VercelPostgresError]: VercelPostgresError - 'missing_connection_string': You did not supply a 'connectionString' and no 'POSTGRES_URL' env var was found. at tf (C:\Users\My\Programming\nextjs-dashboard.next\server\app\seed\route.js:60:5026) at Object.get (C:\Users\My\Programming\nextjs-dashboard.next\server\app\seed\route.js:60:6072) at C:\Users\My\Programming\nextjs-dashboard.next\server\app\seed\route.js:1:3990 at t.a (C:\Users\My\Programming\nextjs-dashboard.next\server\webpack-runtime.js:1:866) at 1507 (C:\Users\My\Programming\nextjs-dashboard.next\server\app\seed\route.js:1:3883) at t (C:\Users\My\Programming\nextjs-dashboard.next\server\webpack-runtime.js:1:127) at C:\Users\My\Programming\nextjs-dashboard.next\server\app\seed\route.js:1:1176 at t.a (C:\Users\My\Programming\nextjs-dashboard.next\server\webpack-runtime.js:1:866) at 2920 (C:\Users\My\Programming\nextjs-dashboard.next\server\app\seed\route.js:1:967) at t (C:\Users\My\Programming\nextjs-dashboard.next\server\webpack-runtime.js:1:127) { code: 'missing_connection_string' }

Build error occurred Error: Failed to collect page data for /seed at C:\Users\My\Programming\nextjs-dashboard\node_modules.pnpm\next@15.0.0-rc.0_react-dom@19.0.0-rc-f994737d14-20240522_react@19.0.0-rc-f994737d14-20240522\node_modules\next\dist\build\utils.js:1274:15 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { type: 'Error' } Collecting page data . ELIFECYCLE  Command failed with exit code 1.

Screenshot (46)

guzmanpdro commented 5 months ago

Here's the solution, greetings 👨‍💻

ZachAlba commented 5 months ago

This can also be resolved by ignoring the failed deployment and skipping ahead to the part where you set up Postgres and your .env file, and then redeploying. At least I believe that's the step that fixed the error for me after some trial and error.

Kashyap-Pandya commented 5 months ago

having same issues , will try what @ZachAlba said. nvm didn't saw @guzmanpdro link. that did the trick. thank you

kaijuh commented 5 months ago

I followed the solution as posted by @guzmanpdro which solved the issue of deployment .

After the successful deployment as outline there, these are the steps I followed:

  1. I added the folder with the route.ts file once again (app/seed/route.ts)
  2. I copy pasted this code https://github.com/vercel/next-learn/blob/main/dashboard/starter-example/app/seed/route.ts
  3. run pnpm i @vercel/postgres in your terminal to install the Vercel Postgres SDK
  4. Ensure your local development server is running with pnpm run dev and navigate to localhost:3000/seed in your browser.
  5. When finished, you will see a message "Database seeded successfully" in the browser. Screenshot 2024-06-30 092628

    Once completed, you can delete this file.

Here are all the steps above https://nextjs.org/learn/dashboard-app/setting-up-your-database

I can then run queries and keep following along the tutorial

image

Cheers