Welcome to 16892 Developer Community-Open, Learning,Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to push a local PostgreSQL database to one I've created on a Heroku app. To set up the Heroku database, I ran heroku addons:create heroku-postgresql:hobby-dev -a jasons-react-jobly-app, where jasons-react-jobly-app is the name of my Heroku app.

Then I ran heroku pg:push jobly DATABASE_URL -a jasons-react-jobly-app, where jobly is the name of my local database.

This throws the below error:

heroku-cli: Pushing jobly ---> postgresql-animate-30221
                case
------------------------------------
 0.9992547478473790.999254747847379
(1 row)

 !    Cannot read property 'includes' of undefined

The error looks like an error that JavaScript throws when it tries to read properties of an undefined object or something, but I'm not sure where that would be happening in this database push. The app runs completely fine on my local machine with no errors. There is no case column in any of my database tables, so I'm not sure where that number is coming from either.

Also, if I check my Heroku config variables with heroku config, I see:

DATABASE_URL: postgres://iqawqkjfiybndd:c3e921131c239ccd6c880ad4b601deeaa4558339a90ebedc562a5575c9099f42@ec2-54-156-85-145.compute-1.amazonaws.com:5432/dul2u6r13aq5i

So I know the database exists.

Any help with solving this error?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
3.8k views
Welcome To Ask or Share your Answers For Others

1 Answer

You need to fetch the name of the DB that you see attached to the heroku app on heroku dashboard.

At this url https://dashboard.heroku.com/apps/{put-your-app-name-here}/resources To get all app names in heroku cli do heroku apps and you will know which app's DB name you want from its dashboard.

Once you have the name of the DB (it will look like this "postgresql-pointy-81624")

use that name in the command to push local db to that db on heroku .

Here are steps to make sure everything works correctly 1- Check the connectivity to the heroku db first by doing

heroku pg:psql postgresql-[somedb name as found above] --app {your-app-name}

2- If it says to reset the DB and you can afford to reset then reset it using

heroku pg:reset -a {your-app-name}

3- Lastly do the migration of DB using this command

heroku pg:push jobly postgresql-[db name found above] -a {your-app-name}

if everything works as expected you will see this message

heroku-cli: Pushing complete.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to 16892 Developer Community-Open, Learning and Share
...