Prisma1: Unable to deploy when using `managementApiSecret`

Created on 25 Apr 2018  Â·  5Comments  Â·  Source: prisma/prisma1

Bug Report

Current behavior

A prisma deploy to an own Prisma server which has managementApiSecret configured fails (CLI version 1.7.1).

Reproduction

_docker-compose.yml_:

version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.7
    restart: always
    ports:
    - "4466:4466"
    environment:
      PRISMA_CONFIG: |
        managementApiSecret: abcdefgh
        port: 4466
        databases:
          default:
            connector: mysql
            active: true
            host: db
            port: 3306
            user: root
            password: prisma
  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: prisma

_prisma.yml_:

endpoint: http://localhost:4466
datamodel: datamodel.graphql

Executing PRISMA_MANAGEMENT_API_SECRET=abcdefgh prisma deploy leads to:

Creating stage default for service default !
 â–¸    Cluster secret in env var PRISMA_MANAGEMENT_API_SECRET does not match for cluster local

Get in touch if you need help: https://www.graph.cool/forum
To get more detailed output, run $ export DEBUG="*"
bu2-confirmed aredocs

Most helpful comment

Thanks @marktani for digging into this. Based on your detailed investigation, I was able to figure out a solution for the case above:

~/.prisma/config.yml:

clusters:
  local:
    host: http://localhost:4466
    clusterSecret: abcdefgh

Executing PRISMA_MANAGEMENT_API_SECRET=abcdefgh prisma deploy leads to a correct deployment then.

I think we should clarify in the docs, that the clusterSecret should reflect the managementApiSecret from docker-compose.yml. An alternative would be that the CLI does not need a ~/.prisma/config.yml at all, but operates based on the defined environment variables / CLI arguments. This would also lead to a simpler integration into existing CI / CD workflows (see also https://github.com/graphcool/prisma/issues/1919)

All 5 comments

This works for me (fish shell):

begin; set -lx PRISMA_MANAGEMENT_API_SECRET my-server-secret-123; prisma deploy; end

Can you compare your ~/.prisma/config.yml with the different situations I described here: #2273? 🙂 It looks like the error messages for that particular situation are not completely accurate.

Thanks @marktani for digging into this. Based on your detailed investigation, I was able to figure out a solution for the case above:

~/.prisma/config.yml:

clusters:
  local:
    host: http://localhost:4466
    clusterSecret: abcdefgh

Executing PRISMA_MANAGEMENT_API_SECRET=abcdefgh prisma deploy leads to a correct deployment then.

I think we should clarify in the docs, that the clusterSecret should reflect the managementApiSecret from docker-compose.yml. An alternative would be that the CLI does not need a ~/.prisma/config.yml at all, but operates based on the defined environment variables / CLI arguments. This would also lead to a simpler integration into existing CI / CD workflows (see also https://github.com/graphcool/prisma/issues/1919)

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.

run in console prisma generate before prisma deploy!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ragnorc picture ragnorc  Â·  3Comments

nikolasburk picture nikolasburk  Â·  3Comments

thomaswright picture thomaswright  Â·  3Comments

marktani picture marktani  Â·  3Comments

marktani picture marktani  Â·  3Comments