Ask A Question

Notifications

You’re not receiving notifications from this thread.

Rails for Beginners Part 38: Deploying to Heroku Discussion

I wasn't able to see the error where the users database table does not exist. I'm not sure if this is because I am on free tier but only the requests show on the logs and not the error itself:



2021-02-07T18:34:24.162677+00:00 heroku[router]: at=info method=GET path="/sign_up" host=rails-scheduled-tweets.herokuapp.com request_id=1d0bdd35-fa54-42ca-acc6-88b2a061905d fwd="85.240.66.32" dyno=web.1 connect=0ms service=47ms status=500 bytes=1827 protocol=https

2021-02-07T18:34:26.270777+00:00 heroku[router]: at=info method=GET path="/" host=rails-scheduled-tweets.herokuapp.com request_id=4a51fb0c-9e8d-42a5-8e2c-f8dd9ef6da4d fwd="85.240.66.32" dyno=web.1 connect=1ms service=8ms status=200 bytes=3685 protocol=https

2021-02-07T18:34:26.486016+00:00 heroku[router]: at=info method=GET path="/packs/js/application-2d24cb02e79dc1ee88b7.js" host=rails-scheduled-tweets.herokuapp.com request_id=f33fa757-c482-4423-a582-cd49534d7625 fwd="85.240.66.32" dyno=web.1 connect=0ms service=1ms status=304 bytes=48 protocol=https

2021-02-07T18:34:26.498205+00:00 heroku[router]: at=info method=GET path="/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css" host=rails-scheduled-tweets.herokuapp.com request_id=76391c84-82c2-43b1-a1c1-53f3111bef19 fwd="85.240.66.32" dyno=web.1 connect=1ms service=1ms status=304 bytes=48 protocol=https

2021-02-07T18:34:26.646311+00:00 heroku[router]: at=info method=GET path="/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css" host=rails-scheduled-tweets.herokuapp.com request_id=01a9a45f-b89c-4ef4-8361-fc89a27f2fb6 fwd="85.240.66.32" dyno=web.1 connect=0ms service=1ms status=200 bytes=195 protocol=https

2021-02-07T18:34:26.811517+00:00 heroku[router]: at=info method=GET path="/packs/js/application-2d24cb02e79dc1ee88b7.js" host=rails-scheduled-tweets.herokuapp.com request_id=249a55a6-b3fa-4868-b5f5-96d8ecf7b18f fwd="85.240.66.32" dyno=web.1 connect=1ms service=2ms status=200 bytes=15905 protocol=https

2021-02-07T18:35:17.897899+00:00 heroku[router]: at=info method=GET path="/sign_up" host=rails-scheduled-tweets.herokuapp.com request_id=fd19d46c-e12e-4ef3-8821-0505ffa219a8 fwd="85.240.66.32" dyno=web.1 connect=1ms service=7ms status=500 bytes=1827 protocol=https

2021-02-07T18:36:41.193178+00:00 heroku[router]: at=info method=GET path="/sign_up" host=rails-scheduled-tweets.herokuapp.com request_id=aee05fff-f7c9-4bf4-9ced-398de28e3bc6 fwd="85.240.66.32" dyno=web.1 connect=1ms service=9ms status=500 bytes=1827 protocol=https

2021-02-07T18:40:07.355959+00:00 heroku[router]: at=info method=GET path="/sign_up" host=rails-scheduled-tweets.herokuapp.com request_id=a1744b84-680b-49e1-b7b8-49063060392b fwd="85.240.66.32" dyno=web.1 connect=0ms service=13ms status=500 bytes=1827 protocol=https

2021-02-07T18:40:07.668976+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=rails-scheduled-tweets.herokuapp.com request_id=518a43fa-eb33-40b0-8ffc-8e8d8234a31c fwd="85.240.66.32" dyno=web.1 connect=1ms service=2ms status=200 bytes=143 protocol=https
Reply

Hello fellow friends. In my case I did all wrong but in the end I finished.
Here are the stackoverflow => https://stackoverflow.com/questions/23338356/pgconnectionbad-fatal-role-myname-does-not-exist
When I was doing the creation and migration command at rails I bumped with this mistake , so locally I managed to create a super user to my postgresql , I do no know it is ok , but solved the problem.

sudo -u postgres createuser --superuser YOURUSERNAME_HERE

Reply

Your solution worked for me - on Linux Ubuntu - Thank you :)

Reply

Hi anyone to help me with this error?

Reply

after_save_commit do
if publish_at_previously_changed?
TweetJob.set(wait_until: @tweet.publish_at).perform_later(self)
end
end

Rails.root: /home/adalberto/Documents/railsForBeginners/scheduled_tweets

Reply

If you see this error when pushing to Heroku...

git push heroku master
error: src refspec master does not match any
error: failed to push some refs to 'https://git.heroku.com/etc etc etc

It may be because your main git branch is not called master. It may be the newer "main"

Try "git push heroku main"

Reply

The erros is in local hard drive. Please could you review my code at github.com/adalbertobrant /schedule_tweets

Reply

If you newly installed postgresql like me and you have no idea how to create your own user or especially if you are getting "Insufficient priviliges" error after creating your user. Then,

First use postgres user to connect to postgresql.

$ sudo -u postgres psql

Create a role with CREATE DB and LOGIN attributes

postgres=# create role <USERNAME> login createdb;

And then create a database that has the same name as the username you've used above.

postgres=# create database <USERNAME>;
Reply

On my Mac, i am getting this error

rails db:system:change --to=postgresql
Running via Spring preloader in process 42311
invalid option: --to=postgresql

Any idea?

Reply

I tried to fall back to ruby 2.7.5, still same error. Any help?

Reply

Here's how we can do it manually, so we can continue the course (since the command db:system:change can't work)

  1. Open gemfile

comment out sqlite, and add pg gem (find the latest version from rubygems)

Use sqlite3 as the database for Active Record

gem 'sqlite3', '~> 1.4'

Use pg as the database for Active Record

gem 'pg', '~> 1.2', '>= 1.2.3'

  1. Open config/database.yml

copy all from

https://github.com/excid3/scheduled_tweets/blob/master/config/database.yml

and replace the existing file

  1. run this

rails db:setup

then

rails db:migrate

It works.

Reply

It won't let me add Redis to Heroku because I need to add a card to the app. That would be good to know beforehand. Unfortunately, I won't use my card for this so I think I will not be able to fully make use of my app.

Reply

Heroku is retiring their free plans unfortunately :(

Reply

Hey Chris,

unfortunately since November 2022 heroku there is no free plan.

I will evaluate to do in AWS.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.