Home>
How to resolve Redis Timeout Error on Heroku

The purpose is to publish a web application using Ruby on Rails and Vue.js on Heroku.
After the deployment is completed in the production environment, when accessing it, the following error will be displayed on the screen.

We're sorry, but something went wrong.
If i am the application owner check the logs for more information.

When I check the Heroku log, I see the following Redis Timeout Error.

$heroku logs --tail
2020-11-18T23: 02: 00.685859 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/actionpack-5.2.4.2/lib /action_dispatch/middleware/callbacks.rb:26:in `call'
2020-11-18T23: 02: 00.685860 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/actionpack-5.2.4.2/lib /action_dispatch/middleware/debug_exceptions.rb:61:in `call'
2020-11-18T23: 02: 00.685860 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/actionpack-5.2.4.2/lib /action_dispatch/middleware/show_exceptions.rb:33:in `call'
2020-11-18T23: 02: 00.685860 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/rack-dev-mark-0.7 .8/lib/rack/dev-mark/middleware.rb: 19: in `call'
2020-11-18T23: 02: 00.685861 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/railties-5.2.4.2/lib /rails/rack/logger.rb:38:in `call_app'
2020-11-18T23: 02: 00.685861 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/railties-5.2.4.2/lib /rails/rack/logger.rb:26:in `block in call'
2020-11-18T23: 02: 00.685862 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/activesupport-5.2.4.2/lib /active_support/tagged_logging.rb:71: in `block in tagged'
2020-11-18T23: 02: 00.685862 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/activesupport-5.2.4.2/lib /active_support/tagged_logging.rb:28:in `tagged'
2020-11-18T23: 02: 00.685862 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/activesupport-5.2.4.2/lib /active_support/tagged_logging.rb:71: in `tagged'
2020-11-18T23: 02: 00.685863 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/railties-5.2.4.2/lib /rails/rack/logger.rb:26:in `call'
2020-11-18T23: 02: 00.685863 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/actionpack-5.2.4.2/lib /action_dispatch/middleware/remote_ip.rb:81:in `call'
2020-11-18T23: 02: 00.685863 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/actionpack-5.2.4.2/lib /action_dispatch/middleware/request_id.rb:27:in `call'2020-11-18T23: 02: 00.685864 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/rack-2.0.9/lib /rack/method_override.rb:22:in `call'
2020-11-18T23: 02: 00.685865 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/rack-2.0.9/lib /rack/runtime.rb:22:in `call'
2020-11-18T23: 02: 00.685865 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/activesupport-5.2.4.2/lib /active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
2020-11-18T23: 02: 00.685872 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/actionpack-5.2.4.2/lib /action_dispatch/middleware/executor.rb:14:in `call'
2020-11-18T23: 02: 00.685877 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/actionpack-5.2.4.2/lib /action_dispatch/middleware/static.rb:127:in `call'
2020-11-18T23: 02: 00.685877 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/rack-2.0.9/lib /rack/sendfile.rb:111:in `call'
2020-11-18T23: 02: 00.685877 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/actionpack-5.2.4.2/lib /action_dispatch/middleware/ssl.rb:74:in `call'
2020-11-18T23: 02: 00.685878 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/railties-5.2.4.2/lib /rails/engine.rb:524:in `call'
2020-11-18T23: 02: 00.685878 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/puma-4.3.3/lib /puma/configuration.rb:228:in `call'
2020-11-18T23: 02: 00.685879 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/puma-4.3.3/lib /puma/server.rb:682:in `handle_request'
2020-11-18T23: 02: 00.685879 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/puma-4.3.3/lib /puma/server.rb:472:in `process_client'
2020-11-18T23: 02: 00.685880 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/puma-4.3.3/lib /puma/server.rb:328:in `block in run'
2020-11-18T23: 02: 00.685880 + 00: 00 app [web.1]: [b5907c8f-00a5-4a0e-82f9-392c99c1147e] vendor/bundle/ruby ​​/ 2.6.0/gems/puma-4.3.3/lib /puma/thread_pool.rb:134:in `block in spawn_thread'
2020-11-18T23: 02: 00.701193 + 00: 00 heroku [router]: at = info method = GET path = "/ serviceworker.js" host = test-app.herokuapp.com request_id = b5907c8f-00a5-4a0e-82f9 -392c99c1147e fwd = "106.180.3.133" dyno = web.1 connect = 1ms service = 11424ms status = 500 bytes = 8413 protocol = https
2020-11-18T23: 02: 17.036047 + 00: 00 app [web.1]: I, [2020-11-19T08: 02: 17.035948 # 4] INFO-: [301cefd9-5f23-40ec-83af-242fdd3cf398] Started GET "/serviceworker.js" for 106.180.3.133 at 2020-11-19 08:02:17 +0900
2020-11-18T23: 02: 27.054081 + 00: 00 app [web.1]: F, [2020-11-19T08: 02: 27.053943 # 4] FATAL-: [301cefd9-5f23-40ec-83af-242fdd3cf398]
2020-11-18T23: 02: 27.054271 + 00: 00 app [web.1]: F, [2020-11-19T08: 02: 27.054058 # 4] FATAL-: [301cefd9-5f23-40ec-83af-242fdd3cf398] Redis :: CannotConnectError (Error connecting to Redis on ec2-54-197-236-250.compute-1.amazonaws.com:20259 (Redis :: TimeoutError)):
2020-11-18T23: 02: 27.054333 + 00: 00 app [web.1]: F, [2020-11-19T08: 02: 27.054269 # 4] FATAL-: [301cefd9-5f23-40ec-83af-242fdd3cf398]
2020-11-18T23: 02: 27.054488 + 00: 00 app [web.1]: F, [2020-11-19T08: 02: 27.054396 # 4] FATAL-: [301cefd9-5f23-40ec-83af-242fdd3cf398] vendor/bundle/ruby ​​/ 2.6.0/gems/redis-4.1.3/lib/redis/client.rb: 362: in `rescue in establish_connection'

What should I do to resolve the Redis :: TimeoutError in Redis above?
By the way, Heroku's Redis plan etc. are as follows.

$heroku redis: info -a
===
Plan: Hobby Dev
Status: available
Created: 2020-11-03 06:44
Version: 5.0.10
Timeout: 60
Maxmemory: allkeys-lru
Maintenance: not required
Maintenance window: Wednesdays 21:00 to Thursdays 01:00 UTC
Persistence: None
HA Status: Unavailable
Requires TLS: No
Keyspace Notifications: Disabled

Please give us your advice.