[英]MongoDB react app working locally not in heroku
I am trying to deploy a react site with Heroku everything is working except the data from my MongoDB Atlas is not sending to Heroku.我正在尝试使用 Heroku 部署一个反应站点,除了我的 MongoDB Atlas 中的数据未发送到 Heroku 之外,一切正常。 The app is working as it should locally, I have tried everything I have seen on the help section and I am not sure what to do next.
该应用程序在本地正常运行,我已经尝试了我在帮助部分看到的所有内容,但我不确定下一步该做什么。
This is where I connect the MongoURI to the heroku app这是我将 MongoURI 连接到 heroku 应用程序的地方
This is where the cluster is shown it is connected in Heroku tails这是显示集群在 Heroku 尾部连接的位置
Frequently you cannot connect to your cluster from a non-whitelisted IP ie your Heroku's server IP.通常,您无法从未列入白名单的 IP (即 Heroku 的服务器 IP)连接到集群。 To test this - if you have a test env or the project doesn't have any data in it yet, you can open up your cluster to the world, check that the data is being pulled and then enable white-listing and add your server's IP.
为了测试这一点——如果你有一个测试环境或者项目中还没有任何数据,你可以向全世界开放你的集群,检查数据是否被拉取,然后启用白名单并添加你的服务器IP。 For maximum security you don'y want to open up your cluster to all connections, instead just add you IP.
为了获得最大的安全性,您不想向所有连接打开集群,而是只需添加 IP。
Refer to the screen attached.请参阅随附的屏幕。 In Atlas panel, go to your cluster, Network Access and click
ADD IP ADDRESS
.在 Atlas 面板中,go 到您的集群,网络访问并单击
ADD IP ADDRESS
。 This might look a bit different for you if there are no address there yet - then follow the config wizard.如果那里还没有地址,这对您来说可能看起来有点不同 - 然后按照配置向导进行操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.