「heroku run」でETIMEDOUTエラー

どうも。今回はheroku runETIMEDOUTのエラーが出ましたので、それについての対処法を書いておきたいと思います。

【Heorku】「heroku run」でETIMEDOUTエラー

結論

結論から言うと、以下のようにコマンドを打ち込めばOKです。

heroku run:detached rails db:migrate

参考:「heroku run」で発生するETIMEDOUTの原因と解決方法について


以下はエラー時のコマンドです。

コード


$ heroku container:login # いつも通りログイン
Login Succeeded

$ heroku container:push web # いつも通りコンテナプッシュ
Your image has been successfully pushed. You can now release it with the 'container:release' command.

$ heroku container:release web # リリース
Releasing images web to shielded-plains-89486... done

$ heroku open

$ heroku run rails db:migrate # migrateしようとしたら、、、ETIMEDOUTエラー
Running rails db:migrate on ⬢ shielded-plains-89486... done
Error: connect ETIMEDOUT 44.194.22.218:5000

$ heroku run rails db:create # またしてもエラー。ログの確認へ。
Running rails db:create on ⬢ shielded-plains-89486... done
Error: connect ETIMEDOUT 44.193.194.211:5000

$ heroku logs -t # ログ確認
2022-01-08T21:31:24.169881+00:00 app[web.1]: web-console (4.2.0) lib/web_console/middleware.rb:17:in `call'
2022-01-08T21:31:24.169882+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
2022-01-08T21:31:24.169882+00:00 app[web.1]: railties (7.0.0) lib/rails/rack/logger.rb:36:in `call_app'
2022-01-08T21:31:24.169882+00:00 app[web.1]: railties (7.0.0) lib/rails/rack/logger.rb:25:in `block in call'
2022-01-08T21:31:24.169883+00:00 app[web.1]: activesupport (7.0.0) lib/active_support/tagged_logging.rb:99:in `block in tagged'
2022-01-08T21:31:24.169883+00:00 app[web.1]: activesupport (7.0.0) lib/active_support/tagged_logging.rb:37:in `tagged'
2022-01-08T21:31:24.169883+00:00 app[web.1]: activesupport (7.0.0) lib/active_support/tagged_logging.rb:99:in `tagged'
2022-01-08T21:31:24.169883+00:00 app[web.1]: railties (7.0.0) lib/rails/rack/logger.rb:25:in `call'
2022-01-08T21:31:24.169883+00:00 app[web.1]: sprockets-rails (3.4.2) lib/sprockets/rails/quiet_assets.rb:13:in `call'
2022-01-08T21:31:24.169884+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
2022-01-08T21:31:24.169884+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/request_id.rb:26:in `call'
2022-01-08T21:31:24.169885+00:00 app[web.1]: rack (2.2.3) lib/rack/method_override.rb:24:in `call'
2022-01-08T21:31:24.169885+00:00 app[web.1]: rack (2.2.3) lib/rack/runtime.rb:22:in `call'
2022-01-08T21:31:24.169885+00:00 app[web.1]: activesupport (7.0.0) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
2022-01-08T21:31:24.169885+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/server_timing.rb:20:in `call'
2022-01-08T21:31:24.169885+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/executor.rb:14:in `call'
2022-01-08T21:31:24.169886+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/static.rb:23:in `call'
2022-01-08T21:31:24.169886+00:00 app[web.1]: rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
2022-01-08T21:31:24.169886+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/host_authorization.rb:137:in `call'
2022-01-08T21:31:24.169887+00:00 app[web.1]: railties (7.0.0) lib/rails/engine.rb:530:in `call'
2022-01-08T21:31:24.169887+00:00 app[web.1]: puma (5.5.2) lib/puma/configuration.rb:249:in `call'
2022-01-08T21:31:24.169887+00:00 app[web.1]: puma (5.5.2) lib/puma/request.rb:77:in `block in handle_request'
2022-01-08T21:31:24.169887+00:00 app[web.1]: puma (5.5.2) lib/puma/thread_pool.rb:340:in `with_force_shutdown'
2022-01-08T21:31:24.169887+00:00 app[web.1]: puma (5.5.2) lib/puma/request.rb:76:in `handle_request'
2022-01-08T21:31:24.169888+00:00 app[web.1]: puma (5.5.2) lib/puma/server.rb:447:in `process_client'
2022-01-08T21:31:24.169888+00:00 app[web.1]: puma (5.5.2) lib/puma/thread_pool.rb:147:in `block in spawn_thread'
2022-01-08T21:31:24.303912+00:00 heroku[router]: at=info method=GET path="/" host=shielded-plains-89486.herokuapp.com request_id=a1c351db-19a5-48b1-ad6e-6e167e4731c9 fwd="165.76.248.90" dyno=web.1 connect=0ms service=1200ms status=500 bytes=64142 protocol=https
2022-01-08T21:31:24.995033+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=shielded-plains-89486.herokuapp.com request_id=ac7bd07e-b182-42fa-8051-b101155dadc0 fwd="165.76.248.90" dyno=web.1 connect=0ms service=4ms status=200 bytes=143 protocol=https
2022-01-08T21:33:04.900308+00:00 app[api]: Starting process with command `rails db:migrate` by user shinjia305@gmail.com
2022-01-08T21:33:21.788262+00:00 heroku[run.8248]: State changed from starting to up
2022-01-08T21:33:21.857901+00:00 heroku[run.8248]: Awaiting client
2022-01-08T21:33:51.887806+00:00 heroku[run.8248]: Error R13 (Attach error) -> Failed to attach to process
2022-01-08T21:33:51.889077+00:00 heroku[run.8248]: Process exited with status 128
2022-01-08T21:33:51.955757+00:00 heroku[run.8248]: State changed from up to complete
2022-01-08T21:34:42.673063+00:00 app[api]: Starting process with command `rails db:create` by user shinjia305@gmail.com
2022-01-08T21:34:59.014953+00:00 heroku[run.4983]: Awaiting client
2022-01-08T21:34:59.154956+00:00 heroku[run.4983]: State changed from starting to up
2022-01-08T21:35:29.046147+00:00 heroku[run.4983]: Error R13 (Attach error) -> Failed to attach to process
2022-01-08T21:35:29.046954+00:00 heroku[run.4983]: Process exited with status 128
2022-01-08T21:35:29.097120+00:00 heroku[run.4983]: State changed from up to complete
2022-01-08T21:35:57.593158+00:00 app[web.1]: Started GET "/" for 165.76.248.90 at 2022-01-08 21:35:57 +0000
2022-01-08T21:35:57.593910+00:00 app[web.1]: Cannot render console from 165.76.248.90! Allowed networks: 127.0.0.0/127.255.255.255, ::1
2022-01-08T21:35:57.603323+00:00 app[web.1]: ActiveRecord::SchemaMigration Pluck (1.1ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2022-01-08T21:35:57.607490+00:00 app[web.1]: CACHE ActiveRecord::SchemaMigration Pluck (0.0ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2022-01-08T21:35:57.608501+00:00 app[web.1]: 
2022-01-08T21:35:57.608502+00:00 app[web.1]: ActiveRecord::PendingMigrationError (
2022-01-08T21:35:57.608502+00:00 app[web.1]: 
2022-01-08T21:35:57.608504+00:00 app[web.1]: Migrations are pending. To resolve this issue, run:
2022-01-08T21:35:57.608504+00:00 app[web.1]: 
2022-01-08T21:35:57.608505+00:00 app[web.1]: bin/rails db:migrate RAILS_ENV=development
2022-01-08T21:35:57.608505+00:00 app[web.1]: 
2022-01-08T21:35:57.608506+00:00 app[web.1]: You have 1 pending migration:
2022-01-08T21:35:57.608507+00:00 app[web.1]: 
2022-01-08T21:35:57.608507+00:00 app[web.1]: 20220104113349_create_users.rb
2022-01-08T21:35:57.608508+00:00 app[web.1]: 
2022-01-08T21:35:57.608508+00:00 app[web.1]: 
2022-01-08T21:35:57.608509+00:00 app[web.1]: ):
2022-01-08T21:35:57.608509+00:00 app[web.1]: 
2022-01-08T21:35:57.608510+00:00 app[web.1]: activerecord (7.0.0) lib/active_record/migration.rb:627:in `check_pending!'
2022-01-08T21:35:57.608511+00:00 app[web.1]: activerecord (7.0.0) lib/active_record/migration.rb:592:in `block (2 levels) in call'
2022-01-08T21:35:57.608512+00:00 app[web.1]: activesupport (7.0.0) lib/active_support/file_update_checker.rb:83:in `execute'
2022-01-08T21:35:57.608512+00:00 app[web.1]: activerecord (7.0.0) lib/active_record/migration.rb:597:in `block in call'
2022-01-08T21:35:57.608513+00:00 app[web.1]: activerecord (7.0.0) lib/active_record/migration.rb:589:in `synchronize'
2022-01-08T21:35:57.608513+00:00 app[web.1]: activerecord (7.0.0) lib/active_record/migration.rb:589:in `call'
2022-01-08T21:35:57.608514+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
2022-01-08T21:35:57.608514+00:00 app[web.1]: activesupport (7.0.0) lib/active_support/callbacks.rb:99:in `run_callbacks'
2022-01-08T21:35:57.608515+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
2022-01-08T21:35:57.608515+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/executor.rb:14:in `call'
2022-01-08T21:35:57.608516+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
2022-01-08T21:35:57.608516+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
2022-01-08T21:35:57.608517+00:00 app[web.1]: web-console (4.2.0) lib/web_console/middleware.rb:132:in `call_app'
2022-01-08T21:35:57.608517+00:00 app[web.1]: web-console (4.2.0) lib/web_console/middleware.rb:19:in `block in call'
2022-01-08T21:35:57.608518+00:00 app[web.1]: web-console (4.2.0) lib/web_console/middleware.rb:17:in `catch'
2022-01-08T21:35:57.608518+00:00 app[web.1]: web-console (4.2.0) lib/web_console/middleware.rb:17:in `call'
2022-01-08T21:35:57.608519+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
2022-01-08T21:35:57.608520+00:00 app[web.1]: railties (7.0.0) lib/rails/rack/logger.rb:36:in `call_app'
2022-01-08T21:35:57.608520+00:00 app[web.1]: railties (7.0.0) lib/rails/rack/logger.rb:25:in `block in call'
2022-01-08T21:35:57.608521+00:00 app[web.1]: activesupport (7.0.0) lib/active_support/tagged_logging.rb:99:in `block in tagged'
2022-01-08T21:35:57.608521+00:00 app[web.1]: activesupport (7.0.0) lib/active_support/tagged_logging.rb:37:in `tagged'
2022-01-08T21:35:57.608522+00:00 app[web.1]: activesupport (7.0.0) lib/active_support/tagged_logging.rb:99:in `tagged'
2022-01-08T21:35:57.608522+00:00 app[web.1]: railties (7.0.0) lib/rails/rack/logger.rb:25:in `call'
2022-01-08T21:35:57.608523+00:00 app[web.1]: sprockets-rails (3.4.2) lib/sprockets/rails/quiet_assets.rb:13:in `call'
2022-01-08T21:35:57.608523+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
2022-01-08T21:35:57.608524+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/request_id.rb:26:in `call'
2022-01-08T21:35:57.608524+00:00 app[web.1]: rack (2.2.3) lib/rack/method_override.rb:24:in `call'
2022-01-08T21:35:57.608525+00:00 app[web.1]: rack (2.2.3) lib/rack/runtime.rb:22:in `call'
2022-01-08T21:35:57.608525+00:00 app[web.1]: activesupport (7.0.0) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
2022-01-08T21:35:57.608526+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/server_timing.rb:20:in `call'
2022-01-08T21:35:57.608526+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/executor.rb:14:in `call'
2022-01-08T21:35:57.608527+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/static.rb:23:in `call'
2022-01-08T21:35:57.608527+00:00 app[web.1]: rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
2022-01-08T21:35:57.608527+00:00 app[web.1]: actionpack (7.0.0) lib/action_dispatch/middleware/host_authorization.rb:137:in `call'
2022-01-08T21:35:57.608528+00:00 app[web.1]: railties (7.0.0) lib/rails/engine.rb:530:in `call'
2022-01-08T21:35:57.608528+00:00 app[web.1]: puma (5.5.2) lib/puma/configuration.rb:249:in `call'
2022-01-08T21:35:57.608528+00:00 app[web.1]: puma (5.5.2) lib/puma/request.rb:77:in `block in handle_request'
2022-01-08T21:35:57.608528+00:00 app[web.1]: puma (5.5.2) lib/puma/thread_pool.rb:340:in `with_force_shutdown'
2022-01-08T21:35:57.608529+00:00 app[web.1]: puma (5.5.2) lib/puma/request.rb:76:in `handle_request'
2022-01-08T21:35:57.608529+00:00 app[web.1]: puma (5.5.2) lib/puma/server.rb:447:in `process_client'
2022-01-08T21:35:57.608529+00:00 app[web.1]: puma (5.5.2) lib/puma/thread_pool.rb:147:in `block in spawn_thread'
2022-01-08T21:35:57.668811+00:00 heroku[router]: at=info method=GET path="/" host=shielded-plains-89486.herokuapp.com request_id=03f881ab-4b15-4417-9061-810b5eba17e4 fwd="165.76.248.90" dyno=web.1 connect=0ms service=82ms status=500 bytes=64178 protocol=https

2022-01-08T21:40:14.131748+00:00 app[api]: Starting process with command `db:migrate RAILS_ENV=development` by user shinjia305@gmail.com
2022-01-08T21:40:33.730281+00:00 heroku[run.4480]: State changed from starting to up
2022-01-08T21:40:35.037211+00:00 heroku[run.4480]: Awaiting client
2022-01-08T21:41:05.069707+00:00 heroku[run.4480]: Process exited with status 128
2022-01-08T21:41:05.142722+00:00 heroku[run.4480]: State changed from up to complete
2022-01-08T21:41:05.070419+00:00 heroku[run.4480]: Error R13 (Attach error) -> Failed to attach to process

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA