Heroku Not Connecting to Mongo Atlas DB? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience Should we burninate the [wrap] tag? The Ask Question Wizard is Live!Heroku/devise - Missing host to link to! Please provide :host parameter or set default_url_options[:host]Permission denied (publickey) when deploying heroku code. fatal: The remote end hung up unexpectedlyHow to link a folder with an existing Heroku appHow to list all collections in the mongo shell?Why do people use Heroku when AWS is present? What distinguishes Heroku from AWS?Configuring Node.js Connection String for Mongo Labs Database on HerokuHow do I configure phpPgAdmin (hosted on Heroku) to connect to Postgres (hosted on Heroku)how can I connect to a remote mongo server from Mac OS terminalConnection error on Heroku + MongoLab addon with Node.js app - Error: connect ECONNREFUSED 127.0.0.1:27017Host for Mongo db atlas: only work locally not on Heroku

Single word antonym of "flightless"

Book where humans were engineered with genes from animal species to survive hostile planets

When a candle burns, why does the top of wick glow if bottom of flame is hottest?

Why am I getting the error "non-boolean type specified in a context where a condition is expected" for this request?

How discoverable are IPv6 addresses and AAAA names by potential attackers?

Why did the rest of the Eastern Bloc not invade Yugoslavia?

What does an IRS interview request entail when called in to verify expenses for a sole proprietor small business?

English words in a non-english sci-fi novel

porting install scripts : can rpm replace apt?

Short Story with Cinderella as a Voo-doo Witch

When do you get frequent flier miles - when you buy, or when you fly?

How widely used is the term Treppenwitz? Is it something that most Germans know?

How to align text above triangle figure

What LEGO pieces have "real-world" functionality?

Why didn't this character "real die" when they blew their stack out in Altered Carbon?

Denied boarding although I have proper visa and documentation. To whom should I make a complaint?

What is the logic behind the Maharil's explanation of why we don't say שעשה ניסים on Pesach?

Bete Noir -- no dairy

List *all* the tuples!

Is it true that "carbohydrates are of no use for the basal metabolic need"?

What is a non-alternating simple group with big order, but relatively few conjugacy classes?

What's the meaning of 間時肆拾貳 at a car parking sign

Why do people hide their license plates in the EU?

What would be the ideal power source for a cybernetic eye?



Heroku Not Connecting to Mongo Atlas DB?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
Should we burninate the [wrap] tag?
The Ask Question Wizard is Live!Heroku/devise - Missing host to link to! Please provide :host parameter or set default_url_options[:host]Permission denied (publickey) when deploying heroku code. fatal: The remote end hung up unexpectedlyHow to link a folder with an existing Heroku appHow to list all collections in the mongo shell?Why do people use Heroku when AWS is present? What distinguishes Heroku from AWS?Configuring Node.js Connection String for Mongo Labs Database on HerokuHow do I configure phpPgAdmin (hosted on Heroku) to connect to Postgres (hosted on Heroku)how can I connect to a remote mongo server from Mac OS terminalConnection error on Heroku + MongoLab addon with Node.js app - Error: connect ECONNREFUSED 127.0.0.1:27017Host for Mongo db atlas: only work locally not on Heroku



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















My app won't properly deploy or connect to my Mongo Atlas DB on Heroku. It keeps crashing. The heroku URL just says to do the logs, so here are the command line logs:
Command line logs



Here is what my server.js file looks like:
server.js file



Here is what my config/keys looks like:
config/keys file



Here is what my keys_prod.js file looks like:
keys_prod.js file



Here is what my keys_dev.js file looks like (redacted username and password), but this is what I have for my config vars in the heroku backend as well
enter image description here



Also took this screenshot, not sure if it matters though:
enter image description here










share|improve this question






















  • The error is very clear, uri parameter is undefined. Are you sure you had set MONGO_URI in the Config Vars of Heroku?

    – Mauricio Contreras
    Mar 8 at 21:52











  • This was the problem. I had set it to mongoURI like it was in the keys file, and not MONGO_URI as I declared it. Thank you for your assistance!!

    – Buckyx55
    Mar 9 at 1:05

















0















My app won't properly deploy or connect to my Mongo Atlas DB on Heroku. It keeps crashing. The heroku URL just says to do the logs, so here are the command line logs:
Command line logs



Here is what my server.js file looks like:
server.js file



Here is what my config/keys looks like:
config/keys file



Here is what my keys_prod.js file looks like:
keys_prod.js file



Here is what my keys_dev.js file looks like (redacted username and password), but this is what I have for my config vars in the heroku backend as well
enter image description here



Also took this screenshot, not sure if it matters though:
enter image description here










share|improve this question






















  • The error is very clear, uri parameter is undefined. Are you sure you had set MONGO_URI in the Config Vars of Heroku?

    – Mauricio Contreras
    Mar 8 at 21:52











  • This was the problem. I had set it to mongoURI like it was in the keys file, and not MONGO_URI as I declared it. Thank you for your assistance!!

    – Buckyx55
    Mar 9 at 1:05













0












0








0








My app won't properly deploy or connect to my Mongo Atlas DB on Heroku. It keeps crashing. The heroku URL just says to do the logs, so here are the command line logs:
Command line logs



Here is what my server.js file looks like:
server.js file



Here is what my config/keys looks like:
config/keys file



Here is what my keys_prod.js file looks like:
keys_prod.js file



Here is what my keys_dev.js file looks like (redacted username and password), but this is what I have for my config vars in the heroku backend as well
enter image description here



Also took this screenshot, not sure if it matters though:
enter image description here










share|improve this question














My app won't properly deploy or connect to my Mongo Atlas DB on Heroku. It keeps crashing. The heroku URL just says to do the logs, so here are the command line logs:
Command line logs



Here is what my server.js file looks like:
server.js file



Here is what my config/keys looks like:
config/keys file



Here is what my keys_prod.js file looks like:
keys_prod.js file



Here is what my keys_dev.js file looks like (redacted username and password), but this is what I have for my config vars in the heroku backend as well
enter image description here



Also took this screenshot, not sure if it matters though:
enter image description here







reactjs mongodb heroku mongoose






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 17:43









Buckyx55Buckyx55

36110




36110












  • The error is very clear, uri parameter is undefined. Are you sure you had set MONGO_URI in the Config Vars of Heroku?

    – Mauricio Contreras
    Mar 8 at 21:52











  • This was the problem. I had set it to mongoURI like it was in the keys file, and not MONGO_URI as I declared it. Thank you for your assistance!!

    – Buckyx55
    Mar 9 at 1:05

















  • The error is very clear, uri parameter is undefined. Are you sure you had set MONGO_URI in the Config Vars of Heroku?

    – Mauricio Contreras
    Mar 8 at 21:52











  • This was the problem. I had set it to mongoURI like it was in the keys file, and not MONGO_URI as I declared it. Thank you for your assistance!!

    – Buckyx55
    Mar 9 at 1:05
















The error is very clear, uri parameter is undefined. Are you sure you had set MONGO_URI in the Config Vars of Heroku?

– Mauricio Contreras
Mar 8 at 21:52





The error is very clear, uri parameter is undefined. Are you sure you had set MONGO_URI in the Config Vars of Heroku?

– Mauricio Contreras
Mar 8 at 21:52













This was the problem. I had set it to mongoURI like it was in the keys file, and not MONGO_URI as I declared it. Thank you for your assistance!!

– Buckyx55
Mar 9 at 1:05





This was the problem. I had set it to mongoURI like it was in the keys file, and not MONGO_URI as I declared it. Thank you for your assistance!!

– Buckyx55
Mar 9 at 1:05












2 Answers
2






active

oldest

votes


















0














In deployment platforms like heroku, its hard to configure .env . i solved this in my project by using a npm package dotenv. Whatever file need process.env init,use this package



common require.js way :



require('dotenv').config()


its also got some cool options to manage env



here is the link






share|improve this answer






























    0














    I didn't set the Heroku config vars correctly. I had set it to mongoURI like it was in the prod.keys JS folder instead of being MONGO_URI like I had declared it. In addition, I had to whitelist all of the ip's in Heroku's settings.






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55068371%2fheroku-not-connecting-to-mongo-atlas-db%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      In deployment platforms like heroku, its hard to configure .env . i solved this in my project by using a npm package dotenv. Whatever file need process.env init,use this package



      common require.js way :



      require('dotenv').config()


      its also got some cool options to manage env



      here is the link






      share|improve this answer



























        0














        In deployment platforms like heroku, its hard to configure .env . i solved this in my project by using a npm package dotenv. Whatever file need process.env init,use this package



        common require.js way :



        require('dotenv').config()


        its also got some cool options to manage env



        here is the link






        share|improve this answer

























          0












          0








          0







          In deployment platforms like heroku, its hard to configure .env . i solved this in my project by using a npm package dotenv. Whatever file need process.env init,use this package



          common require.js way :



          require('dotenv').config()


          its also got some cool options to manage env



          here is the link






          share|improve this answer













          In deployment platforms like heroku, its hard to configure .env . i solved this in my project by using a npm package dotenv. Whatever file need process.env init,use this package



          common require.js way :



          require('dotenv').config()


          its also got some cool options to manage env



          here is the link







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 8 at 17:57









          vamshi krishnavamshi krishna

          12010




          12010























              0














              I didn't set the Heroku config vars correctly. I had set it to mongoURI like it was in the prod.keys JS folder instead of being MONGO_URI like I had declared it. In addition, I had to whitelist all of the ip's in Heroku's settings.






              share|improve this answer



























                0














                I didn't set the Heroku config vars correctly. I had set it to mongoURI like it was in the prod.keys JS folder instead of being MONGO_URI like I had declared it. In addition, I had to whitelist all of the ip's in Heroku's settings.






                share|improve this answer

























                  0












                  0








                  0







                  I didn't set the Heroku config vars correctly. I had set it to mongoURI like it was in the prod.keys JS folder instead of being MONGO_URI like I had declared it. In addition, I had to whitelist all of the ip's in Heroku's settings.






                  share|improve this answer













                  I didn't set the Heroku config vars correctly. I had set it to mongoURI like it was in the prod.keys JS folder instead of being MONGO_URI like I had declared it. In addition, I had to whitelist all of the ip's in Heroku's settings.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 9 at 1:06









                  Buckyx55Buckyx55

                  36110




                  36110



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55068371%2fheroku-not-connecting-to-mongo-atlas-db%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

                      Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

                      Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved