Mean stack deployed successfully on heroku but I get Application Error - mongodb

I successfully deployed my app to Heroku, Added mLab as my add-on
I also set
heroku config:set MONGOLAB_URI=mongodb://[myusername]:[mypassword]#ds119508.mlab.com:19508/heroku_l1q51vhd
but still I get:

I got the answer. The problem was with authentication. I made new user/pass and it works. You can use Mongochef to check if your connection and authentication with db is correct.

Related

Strapi instalation has error: connect ECONNREFUSED 127.0.0.1:5432

I just install Strapi but with PostgreQL DB (not using -- quickstart which means SQLite)
1. yarn create strap'-app name-of-my-project,
2. submit all QA=default step-by-step (database=strapi, port=default, login/password nothing fancy, and last without SSL connection)
And the finall result is not so descriptive. Only server error with connecting, which I don't know
Connection test failed: connect ECONNREFUSED 127.0.0.1:5433
Problem solved! (after 2 hours of trying instalation)
The answer is => You have to install PostgreSQL DB too on your computer
Once its done, next, you can run Strapi by yarn develop
So the problem is solved. Other problem in meantime solved
`Server wasn't able to start properly. Error: The server does not support SSL connections. Try to install without SSL connection (last question in Strapi install process)
I know you resolved the issue but just posting this in case anybody needs specific instructions.
I followed this tutorial and it's working for me now.
Sidenote: Once I installed Postgres and ran the command psql postgres it prompted me to enter my password. Despite putting in the correct password it still gave me an error that it is the wrong password, so I ran psql postgres postgres and then entering my password resolved the issue for me.
Instead of downloading postgres you can apply docker and it works the same
Link: https://blog.dehlin.dev/docker-with-strapi-v4
I had the same problem and as Kris says above, you need to install postgresql, pgAdmin and create the database first to then can create your Strapi project linked to you database.
I followed this youtube tutorial (in spanish) to solve it very easy.
Also need to avoid enable SSL for your local project. If you need to change this option in the future you can make it in the strapi config/database.js file.
Good luck!

How to see what is in your Heroku-Postgress DB

I recently uploaded a WebApplication to Heroku. I developed it using sqlite; however, I then changed it to Heroku-Postgres.
Nonetheless, I am not able to view in any way the data that is in my database.
There are no problems with the code and the WebApplication works perfectly however it would be very useful to be able to tap into the data.
Download the Heroku CLI and get access to the postgres admin console.
heroku pg:psql -a appName
Use this command in terminal, This will connect you to pgadmin console.
You can use dbeaver database client, but it is very slow because it is free db from heroku.
https://dbeaver.io/download/
Or you can use heroku CLI, psql

Heroku Postgres app works on local machine but not on Heroku

I built and deployed a Node.js Postgres app to Heroku and can not get to any of my endpoints via the Heroku site except the root GET route. Curiously, when I run Heroku local web ALL my endpoints behave exactly as they should. I can successfully perform CRUD on the app running via Heroku local web. However, when I try, for instance, to create a user using the Heroku URL, it returns an empty error message. Yet, when I check the associated database I find that the user was indeed created. Other than returning an empty error message when I try to either create a user or sign it, the app correctly responds with the different errors I programmed. For example, when I tweak my login details or try to register the same user I earlier tried to register it correctly says the user already exists!. Still, when I try to log in that same existing user I get a blank error message. Note that I created both the Heroku PostgreSQL database and my local PostgreSQL database from exactly the same queries. Please, can you help me through this bottleneck? I am using Postman to test my APIs.
Test to sign in user on Heroku app running on the local machine: success!
Same exact test with Heroku URL: cryptic error.
Ok, so after a lot of researching and fiddling around I discovered the solution. I did not add keys from my .env file to Heroku as config vars found under the settings tab of the Heroku User dashboard. Manually adding my environment variables resolved the matter. Now my app is working both on my local machine and via the Heroku URL.

Heroku Postgres can't connect from heroku app

So I have a go rest api running on Heroku. I had the free tier version but now we have moved the app to production and upgraded to a standard-0 database. None of my code changed the only thing that changed were environmental variables to connect to the database. However, when I try to connect to the database I get this error:
[BRONZE] [5-1] sql_error_code = 28000 FATAL: no pg_hba.conf entry for host "54.234.***.***", user "ub21ndj3*****", database "d8useg2o3****", SSL off
From my understanding its an SSL issue. What I don't understand is my app is running on Heroku servers so I shouldn't need to create a tls config to connect to the database and the same code was working with the previous database. Would there be another issue why I'm getting this error?
Heroku's standard databases and above require SSL connections as of April, 2016. You can see the Changelog entry here. You were able to use the same application code on a hobby database because they do not have the same restriction.

Deploying VoltRb app on Heroku with persistence from MongoLab

I'm trying to get a new/blank volt (0.9.5) app into production on Heroku following the instructions on the Volt docs page.
The application deploys successfully until I try and add the Mongo database.
The below creates a new MongoLab database and sets a connection URI to the MONGOLAB_URI variable.
$ heroku addons:create mongolab
I thought all I had to do was copy the below into my config/app.rb file and replace the 'MONGOHQ_URL' with 'MONGOLAB_URI'.
config.db_driver = 'mongo'
config.db_name = (config.app_name + '_' + Volt.env.to_s)
if ENV['MONGOHQ_URL'].present?
config.db_uri = ENV['MONGOHQ_URL'] # you will have to set this on heroku
else
config.db_host = 'localhost'
config.db_port = 27017
end
But this is resulting in an application error and the log is showing the below...
[ERROR] Error adding listener: #<Mongo::AuthenticationError: Failed to authenticate user
Can anyone point me in the right direction?
Some other users suggested that the issue was to do with an outdated version of the volt-mongo gem which was, "using an old version of the Mongo Ruby driver." I have since upgraded to the latest version (currently 0.1.4) and everything seems to be working ok with the database.
This isn't an answer, but you should be able to run heroku config to see what ENV's are set for the dyno. Does that show the ENV?