Hey Everyone! I’ve searched all over to find an an...
# orm-help
n
Hey Everyone! I’ve searched all over to find an answer for this but havent found a solution that quite seems to work. I’ve developed a nodejs express server and am deploying it to elastic beanstalk with a postgres db as a production environment. In the elastic beanstalk configuration of environment variables, I set DATABASE_URL to the correct url of the amazon db. For whatever reason though, the schema.prisma file is unable to read the environment variable being injected by elastic beanstalk. I’d like to avoid having to commit an env for each environment local, dev, prod, etc. What would be the recommended course of action? Thank you in advance for any advice 🙂
Copy code
Error: Schema validation error - Error (query-engine-node-api library)
Error code: P1012
error: Environment variable not found: DATABASE_URL.
  -->  schema.prisma:12
   | 
12 |   url = env("DATABASE_URL")
   | 

Validation Error Count: 1
[Context: getConfig]

Prisma CLI Version : 4.3.1
1
j
This sounds like an EB problem. Can you send the environment variable with the generate command like so
DATABASE_URL=<http://domain.tld> npx prisma generate
?
n
Just tried running it with the correct DB url but it doesnt seem to save it. received this error from EB: Error: EACCES: permission denied, unlink ‘/var/app/current/node_modules/.prisma/client/index.js’ After I tried to run echo “$DATABASE_URL” and unfortunately it returned nothing
I think the error is a result of only the container being able to run the commands and erroring when node makes the attempt
I am not sure if it is EB now as I am able to log the db url in my index.js but the schema is still saying that it’s missing
n
Hi @Nathan 👋 Just to confirm, have you configured these steps mentioned in this guide for deploying apps to Elastic beanstalk?
@Nathan Do let me know in case you are still running into this issue.