0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

学習40日目

Posted at

内容

renderでのデプロイ時のエラーとその解消

前提

  • GoogleMapの機能をローカルで実装完了済
  • renderで本番環境にて動作確認中

エラー・解消法

gon is not defined ...

  • 原因
    • gem 'gon'が本番環境でインストールされていない
  • 解消法
    • gem 'gon' をgemfileのproduction部分に追記する

undefined local variable or method 'latitude' for ... instance

  • 原因
    • ローカルで追加したカラムが本番環境に反映されていない
  • 解消法
    • renderのbuild commandに「bundle exec rake db:migrate:reset」を追記する
    • ProtectedEnvironmentErrorが発生するので、「DISABLE_DATABASE_ENVIRONMENT_CHECK=1」のオプションも追記する

invalid api key

  • 原因
    • 不明でした。renderの環境変数を確認しても設定に問題ありませんでした。
  • 解消法
    • wifiへの再接続
  • 備考
    • 一時的にgoogle apiとrenderとの接続が途切れていただけだったと考えられます。

database "xxxx" is being accessed by other users

  • 原因
    • 本番環境のDB(postgre)への他接続がある状態でrails db:migrate:resetを実行しようとしている
  • 解消法
    • 不明
    • 最終的にrails g migrationでaddculumnのマイグレーションファイルを作成し、build commandのmigrate:resetの部分をmigrateに戻して解決
    • psqlのpg_terminateを試すも権限エラーで実行できず...。

invalid key map error

  • 原因
    • renderへのgoogle api keyに対応するvalueに「''」が入っている
  • 解消法
    • 正しく入力する
  • 備考
    • .envからコピペしたので、文字列をシングルクオートで囲んだままだったのが原因でした

コメント

  • 「We're sorry, but something went wrong ...」を見てもlogを落ち着いて確認すれば解決できる
  • デプロイ前にローカルでの動作確認を漏れなく行うことが大切
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?