LoginSignup
0
1

More than 3 years have passed since last update.

Herokuで運用しているサービスが突如500エラーを吐くようになった。

Posted at

Herokuで運用しているサービスが突如500エラーを吐くようになったので確認。
サービスといってもPoC用に建てたAPIサーバーで、エラー検知等は行ってなかった。

とりあえずログを確認

$ heroku logs -t でとりあえずログを確認

F, [2020-07-29T03:23:19.600711 #4] FATAL -- : [cb47240d-1f9b-4d80-997a-d97ee1a3302e] ActiveRecord::StatementInvalid (PG::InsufficientPrivilege: ERROR:  permission denied for table device_data

PG::InsufficientPrivilege: ERROR: permission denied for table
が出ている。

DBへのアクセス権がないっていってるのでこの記事を参考に確認。

確認していくも関係なさそう。
権限は直近で変更していない。

Herokuのpg独自の問題だと気づく

https://qiita.com/pugiemonn/items/e08f06f22086a7e51b42
こちらの記事通りでしたありがとうございました。

$ heroku pg:info

=== DATABASE_URL
Plan:                  Hobby-dev
Status:                Available
Connections:           2/20
PG Version:            12.3
Created:               2020-07-07 15:55 UTC
Data Size:             12.5 MB
Tables:                6
Rows:                  16132/10000 (Write access revoked)
Fork/Follow:           Unsupported
Rollback:              Unsupported
Continuous Protection: Off
Add-on:                postgresql-lively-57044

heroku のHobby Devプランは10,000件まで😂

データをとりあえず 10,000件以下まで減らす

$ heroku pg:info 

=== DATABASE_URL
Plan:                  Hobby-dev
Status:                Available
Connections:           2/20
PG Version:            12.3
Created:               2020-07-07 15:55 UTC
Data Size:             12.4 MB
Tables:                6
Rows:                  3339/10000 (In compliance)
Fork/Follow:           Unsupported
Rollback:              Unsupported
Continuous Protection: Off
Add-on:                postgresql-lively-57044

再度問題のあったPOST APIを確認

curl -X POST -H 'Authorization: Token' -H 'Content-Type:application/json' -d '{}' https://herokuapp.com/
{"status":200,"message":"successfully created"}%  

OK🎉

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1