Find detail of 404 error on Heroku - heroku

So, I'm kind of new to Heroku. I have a small forum for a private community. New Relic tells me there was a 404 this afternoon. I want to find out the details of the request that returned that 404. What can I do?

You can look at the logs on Heroku with heroku logs.
However, Heroku only allows access to the most recent 1500 lines.
Heroku only stores the last 1500 lines of log history. If you’d like
to persist more than 1500 lines, use a logging add-on.
https://devcenter.heroku.com/articles/logging#log-history-limits
You should install one of the many logging add ons so that you can keep more log history.

Related

Keep data after Heroku dyno restart

I have a twitter bot hosted at Heroku, and once a day the server reboots. I have a text file that is constantly being modified, and when the server is restarted the changes in that file are lost. Does anyone know how to keep that file updated when the server is restarted?
Yes,you have to pay heroku for dynos : https://devcenter.heroku.com/articles/dynos
Or you can always choose to deploy it somewhere else
Heroku file system is ephemeral and gets wiped out at every restart.
A solution (if you want to keep using Heroku) is to use an external service to persist your data:
Amazon S3, see Heroku article
Github, an easy and free option if you need to perform simple get/put, see an example
A database (Atlas MongoDB has a free tier which can be used in cases like yours)

Heroku - access errors - how to select app

I am trying to get heroku setup locally on my new laptop to be able to access an existing heroku account that has two existing rails apps on it. I was able to install heroku cli locally and I was able to login to heroku. If I run "heroku apps" it lists my two apps. But two things I need help with:
1) I can't remember how to tell heroku which app the git repo in the current folder on my laptop should work with on heroku server. in other words, how do i "select" which app i want to current work with after logging into heroku.
2) when I tried running the "heroku config" command to list existing config vars after logging it it gave me some kind of error message. need some suggestions on what might be causing that too.
Sorry to not include screen shots of errors but on a different company right now. hopefully you can at least help me answer the first question.
Thanks,
Edward
ps. I found this Q&A, does the answer here apply to my question (1)?
How to link a folder with an existing Heroku app
The cause turned out to be that I needed to add the heroku app location as a remote repo using the heroku cli from within my local git repo I had created. I used the following command:
heroku git:remote -a thawing-inlet-61413
where "thawing-inlet-61413" is the name of the app. You can get this by running:
heroku apps
and it will list them.
reference: https://devcenter.heroku.com/articles/git#creating-a-heroku-remote

Cloudant add on Heroku not working

I am trying to install cloudant on my vulcan based app.
However when I try to add the free version of cloudant through the heroku addons I get the following error:
Could not communicate with vendor, please try again later
Want to confirm if this is a temporary vendor issue or is it something with my app?
I contacted Heroku support and was told Heroku is in the process of removing the add-on. I don't know any further details, but it looks like in order to have Cloudant work on Heroku you'll need to set the account up yourself.
This sounds like an error in the brokering between Heroku and Cloudant. If you can file a ticket with support#cloudant.com (including account information and time of the failure) we can track it down on our side and see if there's action we can take. Alternatively, you can always signup directly at cloudant.com as a short-term work around.

Heroku: rogue transfer in progress

I started a migration on Heroku last night that gave me no feedback for hours, and which I eventually stopped because it wasn't clear if the system was even doing anything.
Ever since, it's been a nightmare. I cannot access the relevant database tables in heroku console, I can't migrate, rollback, or use pgbackups.
Helpfully, pgbackups gave me a one line explanation just now:
a transfer is currently in progress
This I assume is the migration I tried to execute hours ago. How can I stop whatever Heroku is doing so I can do a quick restore and get back up and running?
You can remove the problem backup stuck in the "a transfer is currently in progress" by finding the name of the backup and then destroying it. E.g.
heroku pgbackups
My problem backup was listed like this:
b210 | 2013/01/02 12:29.33 | unknown | DATABASE_URL
So to destroy it I just did:
heroku pgbackups:destroy b210
It removed the problem backup for me so I could get on with using pgbackups again properly.
I just had this problem too. Found an easier way of fixing it - briefly remove the pgbackups addon.
heroku addons:remove pgbackups
heroku addons:add pgbackups
WARNING as mentioned in the comments below, this will destroy all extant backups!
I accidentally did a transfer from my COLOR_URL database to my DATABASE_URL which was the same database. heroku pgackups:transfer let this happen which caused the main database to get stuck in
a transfer is currently in progress
I fixed it by looking at the process list pg:ps and killing all connections pg:killall
After doing this and looking at pg:ps the process list was empty and I was free to use the main database again with pgbackups.
NOTE this could be a destructive operation so make sure you have a snapshot before you do this.
The real solution is to contact Heroku support and have them kill the rogue process for you. They say they are re-architecting pgbackups to give users more control.
It never became clear what happened - after a day or so I was able to interact with heroku console, but I was never able to run another migration. This is what I did:
Renamed my app to something else.
Created a new app in its place, checking the stack was the same, and copying over all add-ons and domains.
I restored the database from pgbackups (highly recommended if you're not using this add-on).
This fixed the problem. Note: Be careful to check that your pgbackup doesn't cause unacceptable data loss.

Clear Heroku logs (command)

How could I clear heroku logs?
heroku restart will clear logs - although if you're running in production you may not want to do this on a whim :D
Other than that you can use the advanced logging addon (Syslog drains), which gives you the ability to clear the logs:
deprecated
heroku logs:drains clear
Update 2019/08/07
heroku drains
More info: http://devcenter.heroku.com/articles/logging
The current command to clear logs is
heroku drains
Currently, there is no way to clear the Heroku logs. Heroku maintains a record of the past 1500 lines of log activity.

Resources