A valid environment to satisfy PRISMA_SECRET could not be found

prisma

#1

When I try to generate Prisma token, it keeps giving me the following error, even though I have the PRISMA_SECRET configured in dev.env.:

A valid environment variable to satisfy the declaration    
'env:PRISMA_SECRET' could not be found.

My dev.env is configured as following:

PRISMA_ENDPOINT=http://local:4466/
PRISMA_SECRET=somesecret
JWT_SECRET=somesecret

And following is how I start npm run dev:

"dev": "env-cmd ./config/dev.env nodemon src/index.js --ext js,graphql --exec babel-node",

When I console.log(process.env.PRISMA_SECRET), it shows the variable properly so I’m not sure what’s going on. I’m tried restarting Docker and re-deploying Prisma, but to no avail. Any help would be appreciated.


#2

Hi @kevv

You will; need to run prisma token -e dev.env so that Prisma CLI can read your env file and generate the correct token.

Right now CLI is not reading that file as you are not referencing it. We auto reference file named .env but for any other filename you will need to pass the -e flag manually.