Prisma1: Prisma CLI now requires PRISMA_MANAGEMENT_API_SECRET

Created on 19 Feb 2019  ·  17Comments  ·  Source: prisma/prisma1

Describe the bug
After updating CLI and server from 1.23.4 to 1.26.6, I tried to deploy some schema changes but got the following error:

▸ Server at https://... requires a cluster secret. Please
▸ provide it with the env var PRISMA_MANAGEMENT_API_SECRET

Somehow, now I need to include PRISMA_MANAGEMENT_API_SECRET environment variable when running prisma deploy to make it work. I was told on Slack some time ago that the CLI figures out the management api secret so we don't need to provide it (I wasn't providing it until now and it worked well). Also, https://github.com/prisma/prisma/issues/3888 indicates that we should ___not___ provide this environment variable.

To Reproduce
Steps to reproduce the behavior:

  1. prisma deploy without setting PRISMA_MANAGEMENT_API_SECRET environment variable

Expected behavior
It shouldn't need PRISMA_MANAGEMENT_API_SECRET when running prisma deploy.

Versions (please complete the following information):

  • Connector: Postgres
  • Prisma Server: 1.26.6
  • prisma CLI: prisma/1.26.6 node-v10.13.0
  • OS: OS X High Sierra
  • other dependencies: prisma-binding
arecli aredeploy bu0-needs-info

Most helpful comment

This should be fixed in the latest beta 1.29.0-beta.7, please install it via npm install -g prisma@beta

All 17 comments

Hi @frandiox

Can you please try to run prisma logout then prisma login then try this again.

Also, if problem persists try to remove .prisma folder (it is stored in ~/.prisma) and try logging in again. Then deploy this again.

If problem still persists let me know.

@pantharshit00 Tried to logout/login and also removing .prisma but the issue persists. Adding PRISMA_MANAGEMENT_API_SECRET to my .env is the only way to make it work now.

Do you need any other information? Thanks.

Are you trying to deploy to a server added to prisma cloud?

Yes, the server is in Now v1 and is added to Prisma Cloud.

I am having the same issue. No matter how many times I log out and back in, or delete the ~/.prisma folder, I get the same error.

If I roll back two minor versions to 1.25, the issue no longer happens

Now that I think about it, this issue looks similar to another one I reported some time ago: https://github.com/prisma/prisma/issues/3306

In that case I thought my problem was in the deployed Prisma server but now I think that maybe adding PRISMA_MANAGEMENT_API_SECRET to the .env file would have fixed it 🤔

@frandiox 👍

@frandiox : I am able to reproduce this even for version 1.23.4, can you confirm?

Maybe the issue is not in the CLI but the underlying API.

@divyenduz yes, I actually went back to 1.23.4 and the issue persisted. This started happening after I updated that time but perhaps is unrelated to the version. What else could be, DB?

@frandiox : If you are logged in, the CLI using Prisma cloud API to fetch the management secret for your server, if the server is also added in Prisma cloud, you don't need to add that to the environment. It looks like the token resolution from cloud API has broken.

Even if I try to add the env var I get the following:

Cluster secret in env var PRISMA_MANAGEMENT_API_SECRET does not match for cluster default

Now getting:
Can not authenticate against Prisma server. It seems that your PRISMA_MANAGEMENT_API_SECRET environment variable is set incorrectly.

This should be fixed in the latest beta 1.29.0-beta.7, please install it via npm install -g prisma@beta

I can confirm 1.29.0-beta.7 fixes it, thanks!

This is still happening to me. Am running prisma 1.34.8 on ubuntu. Then after adding the PRISMA_MANAGEMENT_API_SECRET on the env file i get another error Cluster secret in env var PRISMA_MANAGEMENT_API_SECRET does not match for cluster default

Was this page helpful?
0 / 5 - 0 ratings