Prisma1: Connect to an existing database PostgreSQL

Created on 21 May 2018  Â·  10Comments  Â·  Source: prisma/prisma1

Bug Report

? Set up a new Prisma server or deploy to an existing server? Use existing database
? What kind of database do you want to deploy to? PostgreSQL
? Does your database contain existing data? Yes
? Enter database host localhost
? Enter database port 5432
? Enter database user postgres
? Enter database password postgres
? Enter name of existing database six
? Enter name of existing schema public

Introspecting database... !
Error: Connection terminated by user
at Client.end (/usr/local/lib/node_modules/prisma/node_modules/pg/lib/client.js:402:36)
at Timeout._onTimeout (/usr/local/lib/node_modules/prisma/node_modules/prisma-db-introspection/src/connectors/PostgresConnector.ts:19:19)
at ontimeout (timers.js:482:11)
at tryOnTimeout (timers.js:317:5)
at Timer.listOnTimeout (timers.js:277:5)
util timed out +0ms
Exiting with code: 0

prisma/1.8.3 (darwin-x64) node-v8.11.1

Reproduction

I have tried with different existing PostgreSQL databases, local or remote, but I always get this error.

Expected behavior?

bu0-needs-info areconnectopostgres areintrospection statustale

Most helpful comment

Hi Guys, I can tell you that with prisma/1.17.1 (darwin-x64) node-v9.4.0 this same database schema was able to be introspected okay, but _only when I ran it in interactive mode._

All 10 comments

Thanks for bringing this up, @riccardomerolla!

I assume this has something to do with your environment, or the way your Postgres database is set up.

Can you share more information about that, so we can start looking into the underlying issue? A repository that reproduces the timeout would be of big help already.

Also, have you tried to connect to the database directly, using a Postgres client?

Hi there!
I'm also having this same problem connecting Prisma to my Postgres DB in an RDS instance. My DB also have existing data. Also, I'm currently successfully connecting to my RDS DB with Navicat and it works just fine. Let me know if you guys need more info or if I can be of any help to solve this issue. I'm really excited to use Prisma in my project.

@riccardomerolla Did you find a solution or maybe a workaround to the issue?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I'm having the exact same problem with Prisma 1.15

@marktani Can you be specific about what further information you want? What does "how your database was set up" mean, exactly?

OS: macOS High Sierra 10.13.6
postgres (PostgreSQL) 10.5

Can this please be reopened?

Can you provide a reproduction? 🙂I shared some relevant questions above https://github.com/prisma/prisma/issues/2481#issuecomment-394410574.

I cannot provide a reproduction, I'm sorry, this is all private IP.

No issues with connecting to the database using psql + the prisma docker instance starts and connects to the database on the host ok. Running prisma deploy also works.

brpro ➜  prisma-test git:(develop) ✗ prisma introspect
  config CWD /Volumes/cs/vadadev-new/admin-poc-graphql-serverless-august-2018/prisma-test +0ms
  config HOME /Users/br +5ms
  config definitionDir /Volumes/cs/vadadev-new/admin-poc-graphql-serverless-august-2018/prisma-test +0ms
  config definitionPath /Volumes/cs/vadadev-new/admin-poc-graphql-serverless-august-2018/prisma-test/prisma.yml +0ms
  cli { isGlobal: true } +0ms
  StatusChecker setting status checker +0ms
  cli command id introspect +6ms
  cli:plugincache Got plugin from cache +0ms
  cli:plugincache /Users/br/Library/Caches/prisma/plugins.json +0ms
  cli:plugincache Got plugin from cache +1ms
  cli:plugincache /Users/br/Library/Caches/prisma/plugins.json +0ms
  plugins findCommand prisma-cli-core +0ms
  plugin requiring command +0ms
  cli-engine:plugins:manager requiring /Users/br/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/prisma-cli-core +0ms
  cli-engine:plugins:manager required +436ms
  plugin required command +439ms
  StatusChecker setting status checker +503ms
? What kind of database do you want to introspect? PostgreSQL
? Enter database host localhost
? Enter database port 5432
? Enter database user ******
? Enter database password  ******
? Enter name of existing database  ******_test
? Use SSL? No
? Enter name of existing schema public

Introspecting database... !
Error: Connection terminated by user
    at Client.end (/Users/br/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/pg/lib/client.js:402:36)
    at Timeout._onTimeout (/Users/br/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/prisma-db-introspection/src/connectors/PostgresConnector.ts:25:19)
    at ontimeout (timers.js:458:11)
    at tryOnTimeout (timers.js:296:5)
    at Timer.listOnTimeout (timers.js:259:5)
  util timed out +0ms
Exiting with code: 0

I've looked at the code, "timeout" is a canard. Something else is going on.

Same problem with the last version. With psql no problem to connect to the database, prisma server run without error, but introspect doesn't work.

→ prisma introspect
config CWD /private/tmp/sixlm +0ms
config HOME /Users/riccardo +2ms
config definitionDir /private/tmp/sixlm +0ms
config definitionPath /private/tmp/sixlm/prisma.yml +0ms
cli { isGlobal: true } +0ms
StatusChecker setting status checker +0ms
cli command id introspect +7ms
cli:plugincache Got plugin from cache +0ms
cli:plugincache /Users/riccardo/Library/Caches/prisma/plugins.json +1ms
cli:plugincache Got plugin from cache +1ms
cli:plugincache /Users/riccardo/Library/Caches/prisma/plugins.json +0ms
plugins findCommand prisma-cli-core +0ms
plugin requiring command +0ms
cli-engine:plugins:manager requiring /usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core +0ms
cli-engine:plugins:manager required +530ms
plugin required command +533ms
StatusChecker setting status checker +596ms
? What kind of database do you want to introspect? PostgreSQL
? Enter database host 172.29.1.11
? Enter database port 5432
? Enter database user postgres
? Enter database password postgres
? Enter name of existing database six_lulm_180608
? Use SSL? No
? Enter name of existing schema public

Introspecting database... !
Error: Connection terminated by user
at Client.end (/usr/local/lib/node_modules/prisma/node_modules/pg/lib/client.js:402:36)
at Timeout._onTimeout (/usr/local/lib/node_modules/prisma/node_modules/prisma-db-introspection/src/connectors/PostgresConnector.ts:25:19)
at ontimeout (timers.js:427:11)
at tryOnTimeout (timers.js:289:5)
at listOnTimeout (timers.js:252:5)
at Timer.processTimers (timers.js:212:10)
Exiting with code: 1

Hi Guys, I can tell you that with prisma/1.17.1 (darwin-x64) node-v9.4.0 this same database schema was able to be introspected okay, but _only when I ran it in interactive mode._

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings