简体   繁体   English

MongoDB 反应应用程序在本地工作不在 heroku

[英]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.

相关问题 React 应用程序在本地工作,但部署到 heroku 时出现应用程序错误 - React app working locally but application error when deployed to heroku React 应用程序在本地运行良好,但在 Heroku 上部署后失败 - React app working well locally but fails after deployment on Heroku 反应路线不适用于 Heroku,但在本地工作 - React Routes Not working on Heroku, but Are working Locally 服务的节点在本地反应但不在heroku上工作 - node serving react working locally but not on heroku 反应路线在本地工作,但不通过 Heroku - React routes working locally but not through Heroku React Router 在本地工作但未部署在 heroku - React Router working locally but not deployed on heroku React 应用程序在本地运行,但在 Heroku 上崩溃 - React app runs locally but crashes on Heroku 为什么我的具有节点和mysql后端的react应用程序在本地运行,但不能在Heroku上运行? - Why is my react app, which has a node and mysql backend, working locally but not on Heroku? Express React应用程序可在本地运行,但在部署Heroku时出错 - Express React app works locally but gives error on heroku deploy 带有 React Router 的 MERN 应用程序在本地和 Heroku 上运行良好,但在 ECS 上运行良好 - MERN app with React Router works fine locally and on Heroku but not on ECS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM