我为我构建的前端应用程序创建了一个数据库和服务器,现在我正在尝试将服务器部署到heroku。我已经设置了配置vars,在Atlas中创建了集群,服务器在本地工作。
当我部署到heroku时,我会收到这个错误MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/
我阅读了所提供的文档,并检查以确保我的IP地址被列出,而且它是。这里有一个指向我所有服务器代码的链接,但我觉得这更像是Atlas/Heroku错误,我甚至不知道从哪里开始。
发布于 2022-04-18 08:42:03
您可以在阿特拉斯系统中安装提供静态IP地址、举个例子和白名单的Heroku外接程序。
请在这篇MongoDB博客文章中找到更多信息
https://stackoverflow.com/questions/71909378
复制相似问题