🔥

504 Gateway Time-out

2023/05/06に公開

Tutorial学習中のメモを再編集しています。

rails server 504eroor

AWS Cloud9
サーバーを起こしてプレビューを見ると504 Gateway Time-outとなっている。
プレビューをずっと見ていたわけではないので関係があるかは分からないが、jQueryとbootstrapを追加したのちに発生

$ rails s

(省略)
Cannot render console from xx.xx.xxx.xx! Allowed networks: 127.0.0.0/127.255.255.255, ::1
   (2.0ms)  SELECT sqlite_version(*)
   (0.2ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC

結論

再起動したら治った。

以下奮闘記

https://github.com/rails/web-console#configweb_consolewhitelisted_ips
https://qiita.com/P-man_Brown/items/b626bc430b324247ab16

2つ参考にして記述

\# config.web_console.permissions = '27.83.241.88'
  config.web_console.permissions = '0.0.0.0/0'
\# config.web_console.permissions = '27.83.241.88'
  config.web_console.permissions = '0.0.0.0'
\# 504 Gateway Time-outへの対処

なぜか保存できず下記のエラーがC9上に出る
書き足したコードを全て消す

Failed to write to 'storage.yml for options). config.active_storage.service = :local # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true # Suppress logger output for asset requests. config.assets.quiet = true # Raises error for missing translations. # config.action_view.raise_on_missing_translations = true # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. config.file_watcher = ActiveSupport::EventedFileUpdateChecker # Orginization to access c9 config.hosts.clear # config.web_console.permissions = '27.83.241.88' config.web_console.permissions = '0.0.0.0' # 504 Gateway Time-outへの対処 end '. Failed to retrieve resource from https://vfs-cloud9.ap-northeast-1.console.aws.amazon.com/vfs/12adca454ca747a9bc899fe18a6310e3/environment/sample_app_2/config/environments/development.rb with code 0.

一度c9を閉じてAWSに戻ると

AWS root account login detected
We do not recommend using your AWS root account to create or work with environments. Use an IAM user instead. This is an AWS security best practice.

再起動したら治った

Discussion