Can anyone shed any light on this issue? <https:/...
# orm-help
t
Any ideas, anyone?
k
In your project is there a hidden file named
.env
in the project's root directory?
The package dotenv (https://www.npmjs.com/package/dotenv) is included. It's a slick package that when the project is run it looks for a file named
.env
(or anything ending with it as an extension, for example
aws.env
) that has variables defined in it that are, when execution starts, loaded as environment variables (if you happen to not know what those are - I imagine you must - but in not, just google it) for the project. Those things you uncommented in in the .yml file? They're like
${env:PRISMA_SECRET}
right? That's the environment variable
PRISMA_SECRET
being referenced. If it's not defined, you get the error. You define it with
.env
. If you don't have
.env
, it's not defined.
When you get your project going you put your own secrets in it, and you protect it (don't commit it, ideally, keep a copy in your notes or symlink it safely from your Dropbox or something). If you ran
graphql create
locally it should've provided you a
.env
file (if not, it's a bug!). But if you didn't, maybe you cloned the project from somewhere? Then it wouldn't be included because
.env
is in the
.gitignore
file.
For example, I made a repo with the advanced boilerplate to demonstrate a bug I think I discovered over the weekend. Your question just reminded me that I should commit my
.env
to make it easier for anyone who happened to clone my project to be able to run it immediately: https://github.com/TiE23/p-b-fragments-bug/blob/master/.env
And finally, in my personal project I took notes on the whole thing for myself. You can read them here: https://github.com/TiE23/metric-teacher/tree/master/server#dotenv