Search code examples
mongodbdockerprismaprisma-graphql

Prisma can't deploy with local Mongodb


This is my docker-compose.yml:

version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.34
    restart: always
    ports:
    - "4466:4466"
    environment:
      PRISMA_CONFIG: |
        port: 4466
        # 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: mongo
            uri: 'http://javad:javad@localhost:27017/admin'
  mongo:
    image: mongo:3.6
    restart: always
    # Uncomment the next two lines to connect to your your database from outside the Docker environment, e.g. using a database GUI like Compass
    # ports:
    # - "27017:27017"
    environment:
      MONGO_INITDB_ROOT_USERNAME: prisma
      MONGO_INITDB_ROOT_PASSWORD: prisma
    ports:
      - "27017:27017"
    volumes:
      - mongo:/var/lib/mongo
volumes:
  mongo:

And my prisma.yml:

endpoint: http://192.168.99.100:4466
datamodel: datamodel.prisma
databaseType: document

When i say

prisma deploy

i get this massage:

ERROR: No cluster could be found for workspace '*' and cluster 'default'

{ "data": { "generateClusterToken": null }, "errors": [ { "message": "No cluster could be found for workspace '*' and cluster 'default'", "locations": [ { "line": 3, "column": 9 } ], "path": [ ], "code": 222 } ], "status": 200 }

Get in touch if you need help: https://slack.prisma.io To get more detailed output, run $ export DEBUG="*" (node:17204) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated

Anyone knows what is the problem?


Solution

  • First of all please check your prisma and prisma cli version and update if possible, since there was a bug in a previous version of the prisma cli (see https://github.com/prisma/prisma/issues/4215).

    After that please verify that the endpoint specified in the prisma.yml is indeed accessible and the port is forwarded correctly. Please test if the problem persists when changing endpoint to localhost or 127.0.0.1.

    Lastly you can try to set the managementApiSecret in the docker config and add PRISMA_MANAGEMENT_API_SECRET to the env file.