any advice on resolving: ``` Exception in thread ...
# orm-help
p
any advice on resolving:
Copy code
Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: mapping values are not allowed here
 in 'string', line 3, column 12:
      databases:
from my
prisma
local docker instance?
n
please share your
docker-compose.yml
file
p
hey nilan:
Copy code
service: snippet-service
stage: dev
# cluster: local-dev

# The endpoint of your Prisma API (deployed to a Prisma Sandbox).
#endpoint: ${env:PRISMA_ENDPOINT}
endpoint: ${env:PRISMA_LOCAL_ENDPOINT}

# The file containing the definition of your data model.
datamodel: datamodel.graphql

# Seed your service with initial data based on `seed.graphql`.
seed:
  import: seed.graphql

# Download the GraphQL schema of the Prisma API into
# `src/generated/prisma.graphql` (as specfied in `.graphqlconfig.yml`).
# Then generate the corresponding TypeScript definitions into
# `src/generated/prisma.ts` (also specfied in `.graphqlconfig.yml`)
# with `graphql prepare` .
hooks:
  post-deploy:
    - graphql get-schema --project database
    - graphql prepare

# If specified, the `secret` must be used to generate a JWT which is attached
# to the `Authorization` header of HTTP requests made against the Prisma API.
# Info: <https://www.prisma.io/docs/reference/prisma-api/concepts-utee3eiquo#authentication>
secret: ${env:PRISMA_MANAGEMENT_API_SECRET}
n
I asked for the
docker-compose.yml
, not
prisma.yml
šŸ™‚
p
šŸ˜† my bad
Copy code
version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.7
    restart: always
    ports:
    - "4466:4466"
    environment:
      PRISMA_CONFIG: |
        managementApiSecret: my-server-secret-123
        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
n
you indented this part one level too much:
Copy code
databases:
            default:
              connector: mysql
              active: true
              host: db
              port: 3306
              user: root
              password: prisma
p
i will check that, thank you
ok, after correcting my errors in
docker-compose.yml
, the initial error is gone
but im still unsure how to specify that I want to use my local prisma/docker instance, not the playground instance
n
what is "the playground instance" šŸ¤”
n
aha, that is controlled using the
endpoint
property in
prisma.yml
p
i have
PRISMA_LOCAL_ENDPOINT="<http://localhost:4466/snippet-service/dev>"
in my
.env
and i use that variable in the config i posted earlier, is that the proper usage?
n
should be
what happens when you say
prisma deploy
?
p
Copy code
yarn prisma deploy                                                                                   130 ↵
yarn run v1.6.0
$ /Users/peter/Sources/Repos/snippet-service/node_modules/.bin/prisma deploy
Creating stage dev for service snippet-service !
 ā–ø    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="*"
error Command failed with exit code 1.
info Visit <https://yarnpkg.com/en/docs/cli/run> for documentation about this command.
n
šŸ™‚ so, the connection to the local cluster works. Looks like the management API secret is not set correctly though
p
not set correctly where?
n
as an env var
p
so is
prisma-cli
unable to pull
PRISMA_MANAGEMENT_API_SECRET
from the env file in the root of my project?
n
looks like šŸ™‚ Which is probably not intended, could you describe the situation in an issue report: https://github.com/graphcool/prisma/?
p
i can but i first need to understand how to get this working
very confused right now
n
you should be able to do
Copy code
set -x PRISMA_MANAGEMENT_API_SECRET "my-server-secret-123"
prisma deploy
(fish shell)
p
that gives me the following error:
Copy code
client Sending query to cluster local +35ms
  client <http://localhost:4466/cluster> +0ms
  client
  client       query($name: String! $stage: String!) {
  client         project(name: $name stage: $stage) {
  client           name
  client           stage
  client         }
  client       }
  client      +0ms
  client { name: 'snippet-service', stage: 'dev' } +0ms
  deploy adding project +45ms

Creating stage dev for service snippet-service...  client Sending query to cluster local +46ms
  client <http://localhost:4466/cluster> +1ms
  client       mutation addProject($name: String! $stage: String! $secrets: [String!]) {
  client         addProject(input: {
  client           name: $name,
  client           stage: $stage
  client           secrets: $secrets
  client         }) {
  client           project {
  client             name
  client           }
  client         }
  client       }
  client        +0ms
  client { name: 'snippet-service',
  client   stage: 'dev',
  client   secrets: [ 'my-server-secret-123' ] } +0ms
 !
Error: Cluster secret in env var PRISMA_MANAGEMENT_API_SECRET does not match for cluster local
    at Client.<anonymous> (/Users/peter/Sources/Repos/snippet-service/node_modules/prisma-cli-engine/src/Client/Client.ts:203:21)
    at step (/Users/peter/Sources/Repos/snippet-service/node_modules/prisma-cli-engine/dist/Client/Client.js:32:23)
    at Object.throw (/Users/peter/Sources/Repos/snippet-service/node_modules/prisma-cli-engine/dist/Client/Client.js:13:53)
    at rejected (/Users/peter/Sources/Repos/snippet-service/node_modules/prisma-cli-engine/dist/Client/Client.js:5:65)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)
Exiting with code: 1
error Command failed with exit code 1.
n
Did you double check that the secret is correct?
It needs to match the one from
docker-compose.yml
my-server-secret-123
p
without quotes, correct?
n
yes
p
yes thats what my
docker-compose.yml
holds
n
is there a different secret entered in
~/.prisma/config.yml
?
p
that is what i have in
~/.prisma/config.yml
n
please don't share that publically šŸ™‚
šŸ‘ 1
I am not able to resolve this momentarily, please raise an issue here: https://github.com/graphcool/prisma/ šŸ™‚
p
ok, thanks for your help šŸ™‚
n
actually, we just released a patch version, could you try that one first?
p
sure
what should I bump, the prisma image? npm package?
n
the CLI šŸ™‚
p
using latest cli, I get the following:
Copy code
Deploying service `snippet-service` to stage `dev` to server `local` 183ms
Service is already up to date.

post-deploy:
Running graphql get-schema --project database āœ”

Running graphql prepare !
 ā–ø    Invalid prisma.yml file
 ā–ø    prisma.yml should NOT have additional properties. additionalProperty: endpoint
 ā–ø
using the following prisma.yml:
Copy code
service: snippet-service
stage: dev

# The endpoint of your Prisma API (deployed to a Prisma Sandbox).
#endpoint: ${env:PRISMA_ENDPOINT}
endpoint: ${env:PRISMA_LOCAL_ENDPOINT}
datamodel: datamodel.graphql
seed:
  import: seed.graphql

hooks:
  post-deploy:
    - graphql get-schema --project database
    - graphql prepare

# If specified, the `secret` must be used to generate a JWT which is attached
# to the `Authorization` header of HTTP requests made against the Prisma API.
# Info: <https://www.prisma.io/docs/reference/prisma-api/concepts-utee3eiquo#authentication>
secret: ${env:PRISMA_SECRET}
# secret: ${env:PRISMA_MANAGEMENT_API_SECRET}
p
that doesn't help, both playground and graphql-cli are the latest
n
then it might be a remaining dep in node_modules or Globally šŸ™‚
p
now i am back to token invalid errors
my dockercompose file has
managementApiSecret: my-server-secret-123
and my
.env
has
PRISMA_MANAGEMENT_API_SECRET="my-server-secret-123"
is this incorrect?
is there a repo that has everything setup correctly so I can check my config files?
this is really far too complicated/poorly documented šŸ˜ž
e
Same problem here...
n
no, this looks correct. again, could you please share a minimal reproduction setup in a new issue here: https://github.com/graphcool/prisma/? šŸ™‚
p
im sorry nilan I cannot expend energy with this project anymore
e
@nilan told me to remove some old dependencies I had in my package.json (prisma-cli and graphql-cli) and it solved the issue.
p
yes I saw that thread, i dont have those dependency issues
n
@peter what's the exact error message you're facing?
p
Copy code
Your Prisma GraphQL database endpoint is live:

  HTTP:  <http://localhost:4466>
  WS:    <ws://localhost:4466>


post-deploy:

Running graphql get-schema --project database... !
Error: 2018-05-01T18:11:57.506Z Environment [ 'prisma-eu1', 'prisma-us1' ]
2018-05-01T18:11:57.509Z Environment { 'prisma-eu1': '<https://eu1.prisma.sh>',
  'prisma-us1': '<https://us1.prisma.sh>' }
2018-05-01T18:11:57.515Z yaml {"additionalProperty":"endpoint"}
Error: Invalid prisma.yml file
prisma.yml should NOT have additional properties. additionalProperty: endpoint
    at Object.<anonymous> (/Users/peter/.nvm/versions/node/v9.7.1/lib/node_modules/graphql-cli/node_modules/prisma-yml/src/yaml.ts:44:11)
    at step (/Users/peter/.nvm/versions/node/v9.7.1/lib/node_modules/graphql-cli/node_modules/prisma-yml/dist/yaml.js:40:23)
    at Object.next (/Users/peter/.nvm/versions/node/v9.7.1/lib/node_modules/graphql-cli/node_modules/prisma-yml/dist/yaml.js:21:53)
    at fulfilled (/Users/peter/.nvm/versions/node/v9.7.1/lib/node_modules/graphql-cli/node_modules/prisma-yml/dist/yaml.js:12:58)
    at <anonymous>

    at Output.<anonymous> (/Users/peter/.nvm/versions/node/v9.7.1/lib/node_modules/prisma/node_modules/prisma-cli-engine/src/Output/index.ts:172:15)
    at step (/Users/peter/.nvm/versions/node/v9.7.1/lib/node_modules/prisma/node_modules/prisma-cli-engine/dist/Output/index.js:40:23)
    at Object.next (/Users/peter/.nvm/versions/node/v9.7.1/lib/node_modules/prisma/node_modules/prisma-cli-engine/dist/Output/index.js:21:53)
    at /Users/peter/.nvm/versions/node/v9.7.1/lib/node_modules/prisma/node_modules/prisma-cli-engine/dist/Output/index.js:15:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/peter/.nvm/versions/node/v9.7.1/lib/node_modules/prisma/node_modules/prisma-cli-engine/dist/Output/index.js:11:12)
    at Output.error (/Users/peter/.nvm/versions/node/v9.7.1/lib/node_modules/prisma/node_modules/prisma-cli-engine/dist/Output/index.js:213:16)
    at Function.<anonymous> (/Users/peter/.nvm/versions/node/v9.7.1/lib/node_modules/prisma/node_modules/prisma-cli-engine/src/Command.ts:70:15)
    at step (/Users/peter/.nvm/versions/node/v9.7.1/lib/node_modules/prisma/node_modules/prisma-cli-engine/dist/Command.js:32:23)
    at Object.throw (/Users/peter/.nvm/versions/node/v9.7.1/lib/node_modules/prisma/node_modules/prisma-cli-engine/dist/Command.js:13:53)
    at rejected (/Users/peter/.nvm/versions/node/v9.7.1/lib/node_modules/prisma/node_modules/prisma-cli-engine/dist/Command.js:5:65)
    at <anonymous>
Exiting with code: 1
my biggest challenge is that prisma cli is acting in a non-deterministic way
n
can you share your
package.json
?
p
i had this error earlier, fixed it, now have it again
Copy code
{
  "name": "snippet-service",
  "license": "MIT",
  "scripts": {
    "start": "dotenv -- nodemon -e ts,graphql -x ts-node src/index.ts",
    "dev": "npm-run-all --parallel start playground",
    "debug": "dotenv -- nodemon -e ts,graphql -x ts-node --inspect src/index.ts",
    "playground": "graphql playground",
    "build": "rimraf dist && tsc"
  },
  "dependencies": {
    "bcryptjs": "2.4.3",
    "graphql-yoga": "1.13.1",
    "jsonwebtoken": "8.2.1",
    "prisma-binding": "1.5.18"
  },
  "devDependencies": {
    "@types/bcryptjs": "2.4.1",
    "dotenv-cli": "1.4.0",
    "graphql-cli": "2.15.13",
    "nodemon": "1.17.3",
    "npm-run-all": "4.1.2",
    "prisma": "1.7.4",
    "rimraf": "2.6.2",
    "ts-node": "6.0.2",
    "typescript": "2.8.3"
  }
}
n
can you also share
Copy code
graphql-cli -v
prisma version
that is the versions from your globally installed CLIs
p
`prisma`: prisma/1.7.4 (darwin-x64) node-v9.7.1
i don't have
graphql-cli
installed globally
n
/Users/peter/.nvm/versions/node/v9.7.1/lib/node_modules/graphql-cli/
this is a global path.
so, somehow there is an old version of
graphql-cli
floating around your dependency tree šŸ™‚ I don't know why, but that's the problem
p
strange
because that doesnt exist
n
can you run
npm list graphql-config-extension-prisma
?
and
npm list graphql-config-extension-prisma -g
p
Copy code
snippet-service@ /Users/peter/Sources/Repos/snippet-service
ā”œā”€ā”¬ graphql-cli@2.15.13
│ └── graphql-config-extension-prisma@0.0.11
└─┬ prisma@1.7.4
  └─┬ prisma-cli-core@1.0.40
    └─┬ graphql-cli@2.15.10
      └── graphql-config-extension-prisma@0.0.10
Copy code
/Users/peter/.nvm/versions/node/v9.7.1/lib
└─┬ prisma@1.7.4
  └─┬ prisma-cli-core@1.0.40
    └─┬ graphql-cli@2.15.10
      └── graphql-config-extension-prisma@0.0.10
n
Hm ok šŸ™‚ I have no further ideas at the moment, you can share your problem here https://github.com/graphcool/prisma
šŸ‘ 1
p
i appreciate your help šŸ™‚
šŸ‘ 1