Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using MongoLab in Heroku doesnt work unless I provide CC number?

I have developed a nodeJS application using Angular as the front-end (used MEAN stack and plan to use Bootstrap with it) and when I try to deploy it to Heroku, whenever I run this line: heroku addons:create mongolab I get the following output:

bruno@bruno-HP-epicsauce:~/herokuFinalApp$ heroku addons:create mongolab
 !    Please verify your account to install this add-on plan (please enter a credit card) For more information, see https://devcenter.heroku.com/categories/billing Verify now at https://heroku.com/verify 
bruno@bruno-HP-epicsauce:~/herokuFinalApp$

And in both sites (mongolab and Heroku) it says it's free... I have already defined the heroku env variable called MONGOLAB_URI, like this:

bruno@bruno-HP-epicsauce:~/herokuFinalApp$ heroku config:set MONGOLAB_URI=mongodb://USER:[email protected]:41643/dbNAME
Setting config vars and restarting rocky-sea-9859... done, v4
MONGOLAB_URI: mongodb://USER:[email protected]:41643/dbNAME
bruno@bruno-HP-epicsauce:~/herokuFinalApp$ heroku config | grep MONGOLAB_URIMONGOLAB_URI: mongodb://USER:[email protected]:41643/dbNAME
bruno@bruno-HP-epicsauce:~/herokuFinalApp$

It still doesnt work...

In the git repository I have the following file structure:

enter image description here

The app is listening on the port: process.env.PORT instead of some local one and the package.json file contains the correct dependencies as it was automatically generated with npm init.

Inside the procfile I have the usual reference to the file that contains my server side code:

web: node server.js

The app.js contains the Angular client-side code.

Is there any 100% free way of deploying an app in Heroku with a DB hosted somewhere?

like image 785
Bruno Oliveira Avatar asked Oct 01 '15 06:10

Bruno Oliveira


1 Answers

You have two options to use MongoLab services on Heroku:

  1. Connect to existing MongoLab deployments from Heroku (no credit card required)
  2. Add MongoLab as a Heroku add-on (credit card required)

Since you have set up MONGOLAB_URI, I assume you created a separate account with MongoLab and created a new MongoDB deployment. In this case you don't need an addon. If you have your MongoDB driver configured to use the connection URI, setting MONGOLAB_URI config on Heroku is usually enough. More info on this here

Heroku asks for a credit card for verification purposes. It won't charge you unless you choose paid addons.

You must verify your account if you want to: Add any add-on to your app, even if the add-on is free. The only exceptions to this are the free plans for the Heroku Postgres and Heroku Connect add-ons, which can be added without verification (source)

like image 107
victmask Avatar answered Oct 28 '22 00:10

victmask