在将其部署到heroku之前,我的任务应用程序在MongoAtlas上运行良好,登录名和CRUD正常运行。但是,当我上载它时,设置环境变量并使用heroku url(https://taskapp-nicode320.herokuapp.com)在Postman中对其进行测试,并使用相同的数据库执行相同的请求,则此操作无效。我尝试了几次以正确设置我的环境变量,但没有一个起作用(带有引号,双引号或不带引号的uri):
Heroku conf:set'MONGO_URI = mongodb + srv:// XXXX:XXXX@firstcluster-eldi8.mongodb.net/taskapp?retryWrites = true&w = majority'
当我尝试在我的应用程序中注册时,为了登录并使用所有功能,Postman冻结并显示消息“发送请求...”,然后显示错误:
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<title>Application Error</title>
<style media="screen">
html,
body,
iframe {
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
overflow: hidden;
}
iframe {
width: 100%;
height: 100%;
border: 0;
}
</style>
</head>
<body>
<iframe src="//www.herokucdn.com/error-pages/application-error.html"></iframe>
</body>
It's my first time deploying to heroku with MongoAtlas and therefore I'm quite stuck. Thanks for your help!