MongoDB not connecting using Heroku CLI - node.js

I recently started learning NodeJS. I have completed my project and deploying it on Heroku. While connecting MongoDB to Heroku i got the following error
I don't know why this URL is considered as the file path.

Do you add config vars in the Heroku setting[If you have some env file]? Add key-value pattern and deploy again. Hope it will work.

Related

Unable to connect to heroku psql database using the command heroku pg:psql

I have a backend node.js app setup in Heroku that uses a postgreSQL database. I have connected it to my github repo and can push my code to heroku fine it seems. I have installed the Heroku Postgres add-on, but for some reason I am unable to access the database using the heroku pg:psql command. When I run the command, it just states Connecting to databasename and no error or anything else pops up. Here are my gitbash commands:
olms2#LAPTOP-O3KD6RL5 MINGW64 ~/OneDrive/Desktop/Coding/Springboard/Current VS Code Projects/final-capstone-2-backend (master)
$ heroku addons
Add-on Plan Price State
ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇ ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇ ΓöÇΓöÇΓöÇΓöÇΓöÇ ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇ
heroku-postgresql (postgresql-elliptical-01419) hobby-dev free created
ΓööΓöÇ as DATABASE
The table above shows add-ons and the attachments to the current app (freebay-backend) or other apps.
olms2#LAPTOP-O3KD6RL5 MINGW64 ~/OneDrive/Desktop/Coding/Springboard/Current VS Code Projects/final-capstone-2-backend (master)
$ heroku pg:psql
--> Connecting to postgresql-elliptical-01419
On a side note, I have no idea why the heroku addons command shows all that gibberish. I have tried deleting the entire app then reinstalling, but I still get the gibberish and unresponsive heroku pg:psql. I should mention that I created the app and installed the addon on the heroku website interface.
Seems there are a bunch of StackOverflow Answers referencing an error with the pg:psql command, but couldn't find any confronting an issue with the command not responding. Happy to provide more info and would really appreciate any help.

Heroku server error 503 in nodejs express api

When I run my nodeJs API on localhost is works perfect but when in uploaded it on server (Heroku) then it gives server 503 error.
Without knowing more about the project, my first guess is something that I ran into just yesterday, where Environment Variables hadn't been declared within Heroku > App > Settings > Config Vars, but were properly in place in the dev environment in the .env file (which should never, ever, ever be pushed to any repository, just so you're aware).
If you could run heroku logs --tail in your CLI and paste in the log for that app, it could help clarify exactly what's happening.

How do I setup Apache CouchDB to run on Heroku?

I have a node.js RESTful API that is using Apache CouchDB for it's NoSQL database. I am new to Heroku and just deployed my API to Heroku instance. However, the startup failed because it couldn't connect to CouchDB. I have researched how to setup CouchDB on Heroku but haven't found anything that works.
I found this buildpack but it doesn't exist any longer: https://elements.heroku.com/buildpacks/aindeev/heroku-buildpack-couchdb
I found this stack overflow post but there doesn't look to be a solution provided: Host couchdb on heroku
Can someone help provide me with some instructions on how I can host couchdb on heroku?
If you are at the step of creating an app you can do the following
heroku create --buildpack https://github.com/creativegeekjp/heroku-buildpack-couchdb.git
and thereby create the app with the couchdb buildpack installed.
however if you already have the app what you can do is
heroku config:add BUILDPACK_URL="https://github.com/creativegeekjp/heroku-buildpack-couchdb.git" -a YOUR_APP
The -a YOUR_APP is optional, you probably don't need it considering you're probably in a folder you've initialized as a heroku app when you add the buildpack.
Or the easier
heroku buildpacks:set https://github.com/creativegeekjp/heroku-buildpack-couchdb.git
after which you have to run
git push heroku master
to deploy your buildpack

Meteor deploy on Heroku Error deploying Node

I built a Meteor app, and it runs on my local machine, where I have meteor installed.
I have never deployed an app online, and am trying to put the app on heroku.
I first tried to use buildpack/jordansissel/heroku-buildpack-meteor.git, but I got an error "Meteor requires Node v0.10.41 or later"
I then tried to use buildpack/michaltakac/meteor-buildpack-horse.git but it failed to push because it couldn't unpack Node.
Lastly I've tried kevinseguin/heroku-buildpack-meteor.git but I get lots of warnings about npm depricated http://prntscr.com/bewzak
When I look at the logs it says "Slug compilation failed: failed to compile Node.js app"
I also get Error: MONGO_URL must be set in environment
I don't know enough to understand what the errors are, or how to get my app deployed
Image of errors: http://prntscr.com/bex0av
my goal it to get the site on gr-fireworks.herokuapp.com
I contacted Heroku helpdesk and they said they couldn't help me because the issue was outside the scope of Heroku Support.
I tried to reach out to Snap CI who said they were successful in deploying it, but when I try to type in exactly what they did, I am still getting the error about Node https://snap-ci.com/ankitsri11/Fireworks/branch/master/logs/defaultPipeline/1/Heroku?back_to=build_history
My repository I'm trying to deloy is on git at github.com/jschwarzwalder/Fireworks
From description of your problem I can conclude you need to do 2 things on your app's Heroku dashboard (Settings tab):
Add MONGO_URL environment variable that points to your Mongo DB database. You can create mongo instance on external service or use mLab Heroku addon (it has free plan).
So your environment variables may look like:
Also, you may need to add METER_SETTINGS if you use --settings settings.json and ROOT_URL - URL of you app gr-fireworks.herokuapp.com (is required).
Set this buildpack:
Ensure you have .git at the end of url.
Now you can deploy your app using single command (if you setup Heroku Toolbelt and heroku remote points Heroku's app repository):
$ git push heroku master

Node js Registration App MongoError

I am trying to deploy an authorization application to heroku. I cloned this repository and created a Procfile with the following line: web: node app.js. I manage to upload the application by git push heroku master but when I open it it says "Application Error". The same is with heroku local. I get "Express server listening on port 5000" and then an error "[MongoError: connect ECONNREFUSED 127.0.0.1:27017]
However, when I follow the repository instructions
In a separate shell start the MongoDB daemon.
mongod
From within the node-login directory, start the server.
node app
everything is fine and the app runs.
I would be so thankful for any help!
Unfortunately, in looking at that code repo it is hard coded to connect to a mongo instance running on your local machine. You can see that by opening the account-manager.js. This is why you get that error when pushing to heroku as when the app launches there is no mongo instance running on localhost.
When deploying to heroku, if you want to run mongo you will have to setup a mongo instance with one of their mongo add ons.
Once you do that, you will need to edit this codebase to connect to the mongo instance you signed up for (through addon) vs localhost. When you create an account with one of the providers you should be able to get a connection string and either use that directly in the code or use heroku's config vars.

Resources