blefnk / relivator-nextjs-template

1.2.6 is coming on July 3 💜 Next.js 15 Store-Landing-Dashboard Starter ▲ i18n Stripe Shadcn Tailwind Drizzle Zod tRPC TypeScript Clerk Authjs Radix UI, Responsive React 19 Server Components, MySQL Postgres Neon TS ORM, Intl App Router Docs User Actions Kit, SaaS Commerce Shop Pricing Payments, Dark Mode, Full Stack Free ▲ more stars → more feature
https://github.com/blefnk/relivator/issues/38#issuecomment-2183480924
MIT License
849 stars 188 forks source link

Error when running `pnpm db:push` #15

Closed luzhengyang closed 8 months ago

luzhengyang commented 9 months ago

Hey,

I'd like try this framework, but I got stuck at the first step when trying to install it locally. I have a postgresql connection string set up in .env, but I got the following error when running pnpm install or pnpm db:push. What is the hostname:'Jg'?

node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

Error: getaddrinfo ENOTFOUND Jg
    at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
    at __node_internal_ (node:internal/errors:715:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'Jg'
}
blefnk commented 9 months ago

Hey, and thanks for your interest in the project! This is a strange error for me too. But let's try to figure it out.


Looks like the issue is related to the Node.js DNS resolution failing for the hostname Jg, resulting in the ENOTFOUND error. The hostname seems incorrect or not resolvable to an IP address, so the application is unable to connect to the PostgreSQL database.

  1. Could you provide the database provider are you working with (Neon, Vercel Storage, or something else)? Additionally, which version of Node.js you're currently using?

  2. Check your PostgreSQL connection string. Make sure it's correctly formatted and doesn't contain any typos or extraneous characters.

  3. Could you please share the format of your connection string? Of course, please redact any sensitive information. In my case, my Neon PostgreSQL connection string looks like this:

    postgres://username:password@something-random-here.eu-central-1.aws.neon.tech/your-database-name
  4. It's unusual for a hostname to be 'Jg', so it's the strange error for me. Usually, it should be something like localhost or an IP address, or like above (something-random-here.eu-central-1.aws.neon.tech).

  5. If you have PostgreSQL installed, you can try connecting to the PostgreSQL database manually by using the following command (if you tried this, please let me know what happens or what do you see):

    psql postgres://username:password@something-random-here.eu-central-1.aws.neon.tech/your-database-name

By following these steps and answering the additional questions, we should be able to narrow down the source of the error.

Also please note, in the file src/data/db/client.ts I specified this:

   const connectionString = process.env.DATABASE_URL + "?sslmode=require";

So there's no need to append ?sslmode=require to your connection string manually.

blefnk commented 8 months ago

Relivator v1.1.0 has been released! 🚀 It now features an even easier installation process, with options to switch technologies on-the-fly, such as PostgreSQL/MySQL and NextAuth.js/Clerk!