Prisma 无法在本地部署 Mongodb

Prisma can't deploy with local Mongodb

这是我的 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:

还有我的prisma.yml:

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

当我说

prisma deploy

我得到了这个按摩:

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

有人知道问题出在哪里吗?

首先请检查您的 prisma 和 prisma cli 版本并在可能的情况下进行更新,因为以前版本的 prisma cli 中存在错误(请参阅 https://github.com/prisma/prisma/issues/4215)。

之后请验证 prisma.yml 中指定的端点确实可以访问并且端口转发正确。请测试将端点更改为 localhost127.0.0.1.

时问题是否仍然存在

最后,您可以尝试在 docker 配置中设置 managementApiSecret 并将 PRISMA_MANAGEMENT_API_SECRET 添加到 env 文件中。