Prisma1: Prisma Deploy Authorization Error

Created on 30 Mar 2019  路  17Comments  路  Source: prisma/prisma1

Describe the bug
Running prisma deploy gives this bug:

ERROR: No 'Authorization' header provided.

{
  "data": {
    "addProject": null
  },
  "errors": [
    {
      "locations": [
        {
          "line": 2,
          "column": 9
        }
      ],
      "path": [
        "addProject"
      ],
      "code": 3015,
      "message": "No 'Authorization' header provided.",
      "requestId": "local:cjtvsmn86098l0780lzufje0n"
    }
  ],
  "status": 200
}

Get in touch if you need help: https://www.prisma.io/forum/
To get more detailed output, run $ export DEBUG="*"

To Reproduce
Steps to reproduce the behavior:

  1. Run prisma deploy
  2. See error

Expected behavior
Should deploy without any errors

Versions (please complete the following information):

  • Connector: [Postgres]
  • Prisma Server: [1.30.0-beta]
  • prisma CLI: [prisma/1.30.0-beta.6 (darwin-x64) node-v11.12.0]
  • OS: [OS X Mojave, Ubuntu]
kinquestion aredeploy

Most helpful comment

What I had to do to update from 1.32 to 1.33:

  • in docker-compose.yml change image to latest version image: prismagraphql/prisma:1.33
  • also in docker-compose.yml make sure you have the managementApiSecret set like that:
environment:
      PRISMA_CONFIG: |
        managementApiSecret: mySecret
  • recreate the docker container: docker-compose up -d
  • create a .env file in the root dir with content PRISMA_MANAGEMENT_API_SECRET=mySecret
  • prisma deploy

btw. a good way to have the secret only in one place (and not be forced to commit it) is to reference it in docker-compose.yml like that: managementApiSecret: "${PRISMA_MANAGEMENT_API_SECRET}" and only have it in the .env file as described above...

All 17 comments

The error message is in regards to a header not being sent (you probably already guessed that).

I'm not 100% sure but I think you have set a secret which isn't declared in ENV when running deploy.

Debugging this would be easier with the contents of your prisma.yml and docker-compose.yml files.

i got the same problem too

@MathiasKandelborg PRISMA_SECRET is set in both .env and prisma.yml

Hi @impowski

Have you set the managementApiSecret in the PRISMA_MANAGEMENT_API_SECRET environment variable? It is required for deployment and you can find it in your docker-compose.yml file.

See: https://www.prisma.io/docs/prisma-server/authentication-and-security-kke4/#management-api-secret

how to set the variable on windows?

@pantharshit00 Yes, it's set in docker-compose.yml and inside .env

@impowski Can you please share a minimal reproduction in a repository?

@cheuk3 In windows use set PRISMA_MANAGEMENT_API_SECRET=yoursecret

@pantharshit00
I did that but still get the same error
ERROR: No 'Authorization' header provided.

@pantharshit00 I mean, set a secret inside prisma.yml, which is a PRISMA_SECRET inside .env. Then set a PRISMA_MANAGEMENT_API_SECRET inside .env and inside docker-compose.yml. Everything working on version prisma/1.30.0-beta.3, starting from prisma/1.30.0-beta.4 something is wrong.

I installed the newest version, which is [email protected] and it does work.

@impowski how to install [email protected] as I tried to install with npm which said "No matching version found for [email protected]".
Thanks

Edit: Just installed it with npm i prisma@beta and it does work :D thanks

I have a nearly identical error on 1.33. Any take aways to resolve Authorization errors?

What I had to do to update from 1.32 to 1.33:

  • in docker-compose.yml change image to latest version image: prismagraphql/prisma:1.33
  • also in docker-compose.yml make sure you have the managementApiSecret set like that:
environment:
      PRISMA_CONFIG: |
        managementApiSecret: mySecret
  • recreate the docker container: docker-compose up -d
  • create a .env file in the root dir with content PRISMA_MANAGEMENT_API_SECRET=mySecret
  • prisma deploy

btw. a good way to have the secret only in one place (and not be forced to commit it) is to reference it in docker-compose.yml like that: managementApiSecret: "${PRISMA_MANAGEMENT_API_SECRET}" and only have it in the .env file as described above...

@DennisKo The problem is still exists in v1.34.0 !

I encountered this error. My solution:

  1. $docker-compose down
  2. DROP DATABASE prisma (SQL client)
  3. $docker-compose up -d
  4. $prisma deploy

Prisma CLI version: prisma/1.34.0 (darwin-x64) node-v12.4.0
Prisma server version: 1.34.0
macOS 10.14.5 (Mojave)

Hey guys, try sudo prisma deploy

I was getting the same issue running prisma deploy on a Digital Ocean droplet from these instructions.

Error:

ERROR: No 'Authorization' header provided.

{
  "data": {
    "addProject": null
  },
  "errors": [
    {
      "locations": [
        {
          "line": 2,
          "column": 9
        }
      ],
      "path": [
        "addProject"
      ],
      "code": 3015,
      "message": "No 'Authorization' header provided.",
      "requestId": "local:cjwzc8bpi000e077173ikilyp"
    }
  ],
  "status": 200
}

directory structure (server root /):

docker-compose.yml
/var
/etc
/auvporsche
    prisma.yml
    datamodel.graphql
    .env

Prisma v1.34

Removed managementApiSecret from docker-compose.yml, removed secret from prisma.yml, ran sudo prisma deploy in /auvporsche and managed to get it to deploy.

Removed managementApiSecret from docker-compose.yml, removed secret from prisma.yml

Please don't do that in production. Your Prisma server will not be secured that way

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hoodsy picture hoodsy  路  3Comments

sedubois picture sedubois  路  3Comments

marktani picture marktani  路  3Comments

tbrannam picture tbrannam  路  3Comments

schickling picture schickling  路  3Comments