1

Hello guys I do not know why but I am getting this strange error on deployment. I have been spending three hours on this but can not get it to work. It has successfully worked before many times and even work once in the three hours deploying a new app. I do not know why I am getting this error on heroku and only heroku.

Gemfile: gemfile

Heroku Error: heroku error

database.yml: database.yml

If anyone have any suggestions, I am all ears!

Nimantha
  • 6,405
  • 6
  • 28
  • 69
petertran98
  • 13
  • 1
  • 2
  • 1
    Welcome to Stack Overflow. [Please don't post screenshots of text](https://meta.stackoverflow.com/a/285557/354577). They can't be searched or copied and offer poor usability. Instead, paste the code as text directly into your question. If you select it and click the `{}` button or Ctrl+K the code block will be indented by four spaces, which will cause it to be rendered as code. – ChrisGPT was on strike May 30 '20 at 22:58
  • Does this answer your question? [Heroku deployment failed because of sqlite3 gem error](https://stackoverflow.com/questions/13083399/heroku-deployment-failed-because-of-sqlite3-gem-error) – ChrisGPT was on strike May 30 '20 at 22:59
  • No it does not. I have tried everything that post has specified like changing the gemfiles which and the database.yml worked before numerous of times. I do not know why it is like this now. – petertran98 May 30 '20 at 23:04

1 Answers1

0

@petertran98 SQLite is a bad fit for running on Heroku. See the official link by heroku SQLite on Heroku and they recommend using Postgres.

To replace SQLite with Postgres, you need to do the folowwing.

Step - 1: Replace gem 'sqlite3' with gem 'pg' in your Gemfile.

Step - 2: Replace adapter: sqlite3 with adapter: postgresql in your database.yml.

Now try running the deployment. It should do the trick. If you still face some issue then you might need to do 1 of following things on the basis of what error you see.

Either you need to manually add Postgres if that does no gets created automatically with deployment script.

heroku addons:create heroku-postgresql

or if you still see the SQLite error then you might need to delete Gemfile.lock file and run bundle install command again.

Pradeep Agrawal
  • 307
  • 2
  • 10
  • THANK YOU! the heroku addons:create heroku-postgresql worked for me. If i wasn't such a newbie at slack I would honor you thanks so much! I do not know why that is a problem I normal never had to manually say "heroku addons:create heroku-postgresql" and it would work . – petertran98 May 30 '20 at 23:39
  • @petertran98 can you mark the answer correct so that others can take benefit from it as well. – Pradeep Agrawal May 31 '20 at 07:38