

他のサイトでも質問したのですが、回答がなかなかつかず、こちらでも質問させていただきます。  
<https://teratail.com/questions/61mpn6dkyaxe50>

### 実現したいこと

render.comでデプロイをしたのですがデプロイに失敗しました。  
原因を知りたいのですが、見つけることができません。  
エラーや原因を見つけるコツや、要因などありますでしょうか？

Gistにエラーログを記入したので、確認して頂けたら幸いです。

[エラーログ全文
(Gist)](https://gist.githubusercontent.com/2J445/dbf44b94834975fa4c0b13ea032c3796/raw/00b01bc1f7890bae317eeb65d28dce3b68ca267a/gistfile1.txt)

**エラーログ (抜粋):**

[code]

    Feb 11 04:11:53 PM  ==> Cloning from https://github.com/2J445/tsunageru...
    Feb 11 04:11:55 PM  ==> Checking out commit 116bfd7c84355336c3b9843a951afccebbb9d5e4 in branch master
    Feb 11 04:11:59 PM  ==> Detected Ruby version 3.0.0
    Feb 11 04:12:09 PM  Updating rubygems-update
    Feb 11 04:12:09 PM  Successfully installed rubygems-update-3.4.6
    Feb 11 04:12:09 PM  Installing RubyGems 3.4.6
    Feb 11 04:12:10 PM    Successfully built RubyGem
    Feb 11 04:12:10 PM    Name: bundler
    Feb 11 04:12:10 PM    Version: 2.4.6
    Feb 11 04:12:10 PM    File: bundler-2.4.6.gem
    Feb 11 04:12:10 PM  Bundler 2.4.6 installed
    Feb 11 04:12:10 PM  RubyGems 3.4.6 installed
    Feb 11 04:12:10 PM  Regenerating binstubs
    Feb 11 04:12:10 PM  Regenerating plugins
    Feb 11 04:12:10 PM  
    
    ～～～
    
    Feb 11 04:12:10 PM  ------------------------------------------------------------------------------
    Feb 11 04:12:10 PM  
    Feb 11 04:12:10 PM  RubyGems installed the following executables:
    Feb 11 04:12:10 PM      /opt/render/project/rubies/ruby-3.0.0/bin/gem
    Feb 11 04:12:10 PM      /opt/render/project/rubies/ruby-3.0.0/bin/bundle
    Feb 11 04:12:10 PM      /opt/render/project/rubies/ruby-3.0.0/bin/bundler
    Feb 11 04:12:10 PM  
    Feb 11 04:12:10 PM  RubyGems system software updated
    Feb 11 04:12:15 PM  ==> Running build command './bin/render-build.sh'...
    Feb 11 04:12:15 PM  Your Gemfile lists the gem rails-i18n (>= 0) more than once.
    Feb 11 04:12:15 PM  You should probably keep only one of them.
    Feb 11 04:12:15 PM  Remove any duplicate entries and specify the gem only once.
    Feb 11 04:12:15 PM  While it's not a problem now, it could cause errors if you change the version of one of them later.
    Feb 11 04:12:18 PM  Fetching gem metadata from https://rubygems.org/..........
    
    ～～～
    
    Feb 11 04:14:03 PM  Bundle complete! 33 Gemfile dependencies, 93 gems now installed.
    Feb 11 04:14:03 PM  Gems in the groups development and test were not installed.
    Feb 11 04:14:03 PM  Bundled gems are installed into `/opt/render/project/.gems`
    Feb 11 04:14:06 PM  rake aborted!
    Feb 11 04:14:06 PM  ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/message_encryptor.rb:203:in `rescue in _decrypt'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/message_encryptor.rb:180:in `_decrypt'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/message_encryptor.rb:154:in `decrypt_and_verify'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/messages/rotator.rb:22:in `decrypt_and_verify'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/encrypted_file.rb:92:in `decrypt'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/encrypted_file.rb:54:in `read'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/encrypted_configuration.rb:21:in `read'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/encrypted_configuration.rb:33:in `config'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/encrypted_configuration.rb:38:in `options'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/delegation.rb:309:in `method_missing'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/devise-4.8.1/lib/devise/secret_key_finder.rb:24:in `key_exists?'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/devise-4.8.1/lib/devise/secret_key_finder.rb:10:in `find'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/devise-4.8.1/lib/devise/rails.rb:37:in `block in <class:Engine>'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:32:in `instance_exec'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:32:in `run'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:61:in `block in run_initializers'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:60:in `run_initializers'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/railties-6.1.7/lib/rails/application.rb:391:in `initialize!'
    Feb 11 04:14:06 PM  /opt/render/project/src/config/environment.rb:5:in `<main>'
    Feb 11 04:14:06 PM  <internal:/opt/render/project/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
    Feb 11 04:14:06 PM  <internal:/opt/render/project/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:35:in `require'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in `block in require'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:299:in `load_dependency'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in `require'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/railties-6.1.7/lib/rails/application.rb:367:in `require_environment!'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/railties-6.1.7/lib/rails/application.rb:533:in `block in run_tasks_blocks'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:61:in `block (2 levels) in define'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/bin/bundle:113:in `load'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/bin/bundle:113:in `<main>'
    Feb 11 04:14:06 PM  
    Feb 11 04:14:06 PM  Caused by:
    Feb 11 04:14:06 PM  ArgumentError: key must be 16 bytes
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/message_encryptor.rb:190:in `key='
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/message_encryptor.rb:190:in `_decrypt'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/message_encryptor.rb:154:in `decrypt_and_verify'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/messages/rotator.rb:22:in `decrypt_and_verify'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/encrypted_file.rb:92:in `decrypt'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/encrypted_file.rb:54:in `read'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/encrypted_configuration.rb:21:in `read'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/encrypted_configuration.rb:33:in `config'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/encrypted_configuration.rb:38:in `options'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/delegation.rb:309:in `method_missing'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/devise-4.8.1/lib/devise/secret_key_finder.rb:24:in `key_exists?'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/devise-4.8.1/lib/devise/secret_key_finder.rb:10:in `find'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/devise-4.8.1/lib/devise/rails.rb:37:in `block in <class:Engine>'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:32:in `instance_exec'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:32:in `run'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:61:in `block in run_initializers'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:60:in `run_initializers'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/railties-6.1.7/lib/rails/application.rb:391:in `initialize!'
    Feb 11 04:14:06 PM  /opt/render/project/src/config/environment.rb:5:in `<main>'
    Feb 11 04:14:06 PM  <internal:/opt/render/project/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
    Feb 11 04:14:06 PM  <internal:/opt/render/project/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:35:in `require'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in `block in require'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:299:in `load_dependency'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in `require'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/railties-6.1.7/lib/rails/application.rb:367:in `require_environment!'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/railties-6.1.7/lib/rails/application.rb:533:in `block in run_tasks_blocks'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:61:in `block (2 levels) in define'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/ruby/3.0.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/bin/bundle:113:in `load'
    Feb 11 04:14:06 PM  /opt/render/project/.gems/bin/bundle:113:in `<main>'
    Feb 11 04:14:06 PM  Tasks: TOP => environment
    Feb 11 04:14:06 PM  (See full trace by running task with --trace)
    Feb 11 04:14:06 PM  ==> Build failed 
    Feb 11 04:14:06 PM  ==> Generating container image from build. This may take a few minutes...
    
[/code]

### 前提

下記の記事を参考にデプロイを進めていました。

[Render.comでRailsアプリの本番環境を作成する方法をどこよりも優しく伝える！ -
Qiita](https://qiita.com/ysk91_engineer/items/b7db950f4739fa896f57)  
[RailsアプリをRender.comでデプロイする手順まとめ -
Qiita](https://qiita.com/koki_73/items/60b327a586129d157f38)

### 発生している問題・エラーメッセージ

githubに反映させてデプロイを試したところ失敗したと表示されましたが、原因を突き止められません。  
エラー箇所を探しているのですが、見つかりませんでした。

### 試したこと

エラー箇所を探そうとしたのですが、わかりませんでした。

デプロイに対しての質問が分からないので、こういう情報を載せてくれると助かる等、教えて頂けたら幸いです。

### 該当のソースコード

puma.rb

[code]

    workers ENV.fetch("WEB_CONCURRENCY") { 4 }
    
    # Use the `preload_app!` method when specifying a `workers` number.
    # This directive tells Puma to first boot the application and load code
    # before forking the application. This takes advantage of Copy On Write
    # process behavior so workers use less memory.
    #
    preload_app!
    
[/code]

production.rb

[code]

    config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? || ENV['RENDER'].present?←追記
    
[/code]

renderibuild.sh

[code]

    #!/usr/bin/env bash
    # exit on error
    set -o errexit
    
    bundle install
    bundle exec rake assets:precompile
    bundle exec rake assets:clean
    bundle exec rake db:migrate
    
[/code]

render.yaml

[code]

    databases:
      - name: アプリの名前を記入しています。
        databaseName: アプリの名前を記入しています。
        user: アプリの名前を記入しています。
        region: singapore
    
    services:
      - type: web
        name: アプリの名前を記入しています。
        env: ruby
        region: singapore
        buildCommand: "./bin/render-build.sh"
        startCommand: "bundle exec puma -C config/puma.rb"
        envVars:
          - key: <%= ENV['DATABASE_URL'] %>
            fromDatabase:
              name: render_app
              property: connectionString
          - key: <%= ENV['RAILS_MASTER_KEY'] %>
            sync: false
    
[/code]

.env.production

[code]

    DB_PASSWORD = '伏せています。'
    DATABASE_URL = '伏せています。'
    RAILS_MASTER_KEY = '伏せています。'
    
[/code]


CC BY-SA 4.0
2023-02-13T14:29:55.723
93827
2023-05-15T01:57:47.383
2023-05-15T01:57:47.383
3060
question
ruby-on-rails ruby render.com
renderでのデプロイ失敗時の原因が見つからない


デプロイ成功しました。config/master.keyファイルの中のキーをrenderのダッシュボードからRAILS_MASTER_KEYのキーと同じにしてgitにプッシュし、デプロイしたところ成功と表示されました。


CC BY-SA 4.0
2023-02-22T17:39:25.397
93956
2023-02-22T17:39:25.397
93827
answer