Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1545

POSTGRES_URL connection string not working for localhost database

$
0
0

This connection string is giving me an error (pasted at the bottom) when I include it in the .env.local file of my Svelte app.

POSTGRES_URL="postgres://myusername:mypassword@localhost:5432/mydatabasename"

(I've substituted 'mypassword' etc, but the real one doesn't have anything weird about it like weird characters)

I have tried all of the following and they all work ...

  • pgAdmin connects ok to that postgres db on localhost 5432

  • pg_isready works ok

> pg_isready -d 'postgres://myusername:mypassword@localhost:5432/mydatabasename'> localhost:5432 - accepting connections
  • psql works ok
psql -d 'postgres://myusername:mypassword@localhost:5432/mydatabasename' -c "Select 1" ?column? ----------        1(1 row)
  • Vercel DB connection string in the same file .env.local - works ok
POSTGRES_URL="postgres://default:vmU398umcu89@ep-aaaaaa-a-aaaaa-aaaaa-pooler.us-east-1.postgres.vercel-storage.com/verceldb"

I have also tried breaking the connection string in different ways ...

 myusername -> myusernamexx -> same error as below mypassword -> mypassworxx  -> same error as below removing password          -> same error as below localhost  -> localhostxx  -> "VercelPostgresError: VercelPostgresError - 'invalid_connection_string'" 5432 -> 5000               -> same error as below removing port              -> same error as below mydatabase -> mydatabasxx  -> same error as below

I have watched the local database terminal window while I was breaking things. If I do a psql with a garbage username then the database log shows FATAL: database "garbageuser" does not exist. But, nothing I do in the .env.local file causes any output in the database output.

Thank you in advance for any help.

The error I get in my Svelte App ...

node:events:492      throw er; // Unhandled 'error' event      ^AggregateError    at internalConnectMultiple (node:net:1114:18)    at afterConnectMultiple (node:net:1667:5)Emitted 'error' event on WebSocket instance at:    at emitErrorAndClose (/Users/tee/Documents/Projects/myappsvelte/node_modules/ws/lib/websocket.js:1016:13)    at ClientRequest.<anonymous> (/Users/tee/Documents/Projects/myappsvelte/node_modules/ws/lib/websocket.js:864:5)    at ClientRequest.emit (node:events:514:28)    at TLSSocket.socketErrorListener (node:_http_client:495:9)    at TLSSocket.emit (node:events:514:28)    at emitErrorNT (node:internal/streams/destroy:151:8)    at emitErrorCloseNT (node:internal/streams/destroy:116:3)    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {  code: 'ECONNREFUSED',  [errors]: [    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    },    Error: connect ECONNREFUSED 127.0.0.1:443        at createConnectionError (node:net:1634:14)        at afterConnectMultiple (node:net:1664:40) {      errno: -61,      code: 'ECONNREFUSED',      syscall: 'connect',      address: '127.0.0.1',      port: 443    }  ]}Node.js v20.10.0

Viewing all articles
Browse latest Browse all 1545

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>