Prisma1: FetchError while setting up Prisma for existing database

Created on 15 Jan 2019  路  4Comments  路  Source: prisma/prisma1

Describe the bug
I am currently following the steps in the documentation here for setting up Prisma with existing database and I was getting an error in when running prisma deploy. So i decided to add the export DEBUG="*" and got this in the console

environment FetchError: request to http://localhost:4466/management failed, reason: socket hang up
  environment     at ClientRequest.<anonymous> (/usr/local/lib/node_modules/prisma/node_modules/node-fetch/lib/index.js:1393:11)
  environment     at emitOne (events.js:116:13)
  environment     at ClientRequest.emit (events.js:211:7)
  environment     at Socket.socketOnEnd (_http_client.js:423:9)
  environment     at emitNone (events.js:111:20)
  environment     at Socket.emit (events.js:208:7)
  environment     at endReadableNT (_stream_readable.js:1064:12)
  environment     at _combinedTickCallback (internal/process/next_tick.js:138:11)
  environment     at process._tickDomainCallback (internal/process/next_tick.js:218:9) +0ms
  environment FetchError: request to http://localhost:4466/management failed, reason: socket hang up
  environment     at ClientRequest.<anonymous> (/usr/local/lib/node_modules/prisma/node_modules/node-fetch/lib/index.js:1393:11)
  environment     at emitOne (events.js:116:13)
  environment     at ClientRequest.emit (events.js:211:7)
  environment     at Socket.socketOnEnd (_http_client.js:423:9)
  environment     at emitNone (events.js:111:20)
  environment     at Socket.emit (events.js:208:7)
  environment     at endReadableNT (_stream_readable.js:1064:12)
  environment     at _combinedTickCallback (internal/process/next_tick.js:138:11)
  environment     at process._tickDomainCallback (internal/process/next_tick.js:218:9) +10ms
Error: Could not connect to server at http://localhost:4466. Please check if your server is running.
    at Deploy.<anonymous> (/usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core/src/commands/deploy/deploy.ts:126:13)
    at step (/usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core/dist/commands/deploy/deploy.js:45:23)
    at Object.next (/usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core/dist/commands/deploy/deploy.js:26:53)
    at fulfilled (/usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core/dist/commands/deploy/deploy.js:17:58)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
  util timed out +0ms
Exiting with code: 0

To Reproduce
Steps to reproduce the behavior:

  1. Run prisma init <project-name> to initialise the project
  2. Input information of a localhost database from the prompt
  3. Run
$ccd <project-name>
$ docker-compose up -d
  1. Try to deploy by running prisma deploy

    1. See the Error

Expected behavior
I was expecting the Prisma API to be deployed

Screenshots
screenshot 2019-01-15 at 11 45 59 pm

Versions:

  • Connector: Postgres v10.4
  • Prisma Server: 1.24.0
  • prisma CLI: prisma/1.24.0 (darwin-x64) node-v8.11.3
  • OS:MacOS Mojave
kinquestion aredeploy

All 4 comments

i have the same issue

Can I see a screenshot of your docker-compose.yml?

I had the same issue a week ago but when I read through the tutorial I discovered that I had to replace localhost with host.docker.internal which solved it for me. @finch001 and @chidioguejiofor you can try it and see if it solves your problem.

version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.24
    restart: always
    ports:
    - "4467:4467"
    environment:
      PRISMA_CONFIG: |
        port: 4467
        # uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
        # managementApiSecret: my-secret
        databases:
          default:
            connector: postgres
            host: host.docker.internal
            database: prisma_graphql
            user: postgres
            password: 
            rawAccess: true
            port: '5432'
            migrations: true

Thanks a lot @chukwuemekachm I changed the host to host.docker.internal and the deploy worked perfectly.
However, I think this fix should be added to the documentation so that others would not be misled by it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

notrab picture notrab  路  3Comments

sedubois picture sedubois  路  3Comments

marktani picture marktani  路  3Comments

ragnorc picture ragnorc  路  3Comments

MitkoTschimev picture MitkoTschimev  路  3Comments