Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostgreSQL on docker and Next.js locally Error: connect ECONNREFUSED ::1:443 #850

Open
davemin opened this issue Jan 9, 2024 · 2 comments

Comments

@davemin
Copy link

davemin commented Jan 9, 2024

Hi, I'am trying to follow this tutorial

https://nextjs.org/learn/dashboard-app/setting-up-your-database

and I'am using @vercel/postgres. Instead to open a remote DB on Vercel I wanto to use a docker image of postgresDB and connect to it. This is my setup:

.env

# Copy from .env.local on the Vercel dashboard
# https://nextjs.org/learn/dashboard-app/setting-up-your-database#create-a-postgres-database
POSTGRES_URL="postgres://postgres:postgres@localhost:5432/postgres"
POSTGRES_PRISMA_URL="postgres://postgres:postgres@localhost:5432/postgres"
POSTGRES_URL_NON_POOLING="postgres://postgres:postgres@localhost:5432/postgres"
POSTGRES_USER="postgres"
POSTGRES_HOST="localhost"
POSTGRES_PASSWORD="postgres"
POSTGRES_DATABASE="postgres"

docker-compose.yml

version: "3.8"

services:
  db:
    container_name: db
    image: postgres:15
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: postgres
    ports:
      - 5432:5432
    volumes:
      - pgdata:/var/lib/postgresql/data

  pgadmin:
    image: dpage/pgadmin4
    environment:
      PGADMIN_DEFAULT_EMAIL: "[email protected]"
      PGADMIN_DEFAULT_PASSWORD: "admin"
    ports:
      - "80:80"
    depends_on:
      - db

volumes:
  pgdata: {}

and my seed file like in tutorial:

https://github.com/vercel/next-learn/blob/main/dashboard/starter-example/scripts/seed.js

the error when I run node -r dotenv/config ./scripts/seed.js is:

 Error: connect ECONNREFUSED ::1:443
        at createConnectionError (node:net:1634:14)
        at afterConnectMultiple (node:net:1664:40) {
      errno: -61,
      code: 'ECONNREFUSED',
      syscall: 'connect',
      address: '::1',
      port: 443
    },

Is @vercel/postgres able to connect locally? How can I work locally on my mac without open a remote Database on Vercel.

Additional note: I'am able to connect with other GUI client like TablePlus or AceSql o PGAdmin so my postgress DB docker container is correctly up and running.

Any ideas how to solve?

Thx all

@NeuroWhAI
Copy link

Related issue : #701

@dx1ded
Copy link

dx1ded commented Nov 13, 2024

+1, how did u fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants