[英]connect prisma and migrate aws ebs
after deploying successfully my nodejs app to AWS ellastic beanstalk, I could open it on postman and check my routes, although it was all working correctly, from ebs logs, i could see a javascript error: Environment variable not found: DATABASE_URL.
在将我的 nodejs 应用程序成功部署到 AWS ellastic beanstalk 后,我可以在 postman 上打开它并检查我的路由,尽管它一切正常,但从 ebs 日志中,我可以看到 javascript 错误: Environment variable not found: DATABASE_URL.
so it seems that my app on aws doesnt have a DATABASE_URL environment to load on my prisma/schema.prisma file.所以似乎我在 aws 上的应用程序没有 DATABASE_URL 环境来加载我的 prisma/schema.prisma 文件。
on the other hand, I discovered that AWS does provide database connection details through proccess.env
as follows here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-nodejs.rds.html#nodejs-rds-create另一方面,我发现 AWS 确实通过proccess.env
提供了数据库连接详细信息,如下所示: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-nodejs.rds.html# nodejs-rds-创建
but i have no clue how can i connect to my database on aws when its in production but with my.env DATABASE_URL when its in development.但我不知道如何在生产时连接到我的 aws 数据库,但在开发时使用 my.env DATABASE_URL。
You would need to add your DATABASE_URL env variable in the Elastic Bean Stalk environment.您需要在 Elastic Bean Stalk 环境中添加 DATABASE_URL 环境变量。
Configuration
option from the sidebar.在您的环境中 select 侧栏中的Configuration
选项。Edit
from Actions
menu.单击“软件类别”和“ Actions
”菜单中的 select Edit
。Environment Properties
section and click on Apply.在这种情况下,在Environment Properties
部分中添加您的环境变量 (DATABASE_URL),然后单击 Apply。 Now your app should be able to access DATABASE_URL through process.env.DATABASE_URL
variable.现在您的应用程序应该能够通过process.env.DATABASE_URL
变量访问 DATABASE_URL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.