質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.46%
unicorn

Unicornは、汎用のRackアプリケーションサーバ。RackとWebサーバーの機能を併せ持ちます。レスポンス処理や、Nginx単体がRackの機能をサポートしていない事から、一般的にはNginx+Unicorn+Railsの構成を取って用います。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

2322閲覧

undefined method `deep_symbolize_keys' のエラー

moonlight4_6_17

総合スコア12

unicorn

Unicornは、汎用のRackアプリケーションサーバ。RackとWebサーバーの機能を併せ持ちます。レスポンス処理や、Nginx単体がRackの機能をサポートしていない事から、一般的にはNginx+Unicorn+Railsの構成を取って用います。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2021/04/24 11:21

編集2021/04/24 11:32

達成したいこと

railsで作成したアプリをAWSでデプロイしたい。

起きている問題

ページが表示されず、unicornのエラーログを見にいくと
undefined method `deep_symbolize_keys'
のエラーが発生している。

試して見たこと

ググって見たところ、このエラーは
config/locales
のファイルのインデントのずれなどで発生しているエラーのようなので、config/localesディレクトリにすでにあった
en.ymlを削除しja.ymlを作成した。

その際に手書きでなく

$ wget https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/ja.yml -P config/locales/

でダウンロードしました。
が、エラーは変わらず。。

実際のエラー文

$ cat unicorn.log I, [2021-04-24T10:44:35.835008 #19006] INFO -- : worker=0 ready E, [2021-04-24T10:45:35.770351 #19007] ERROR -- : app error: undefined method `deep_symbolize_keys' for #<String:0x0000000004f061b8> (NoMethodError) E, [2021-04-24T10:45:35.770456 #19007] ERROR -- : /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/secrets.rb:31:in `block in parse' E, [2021-04-24T10:45:35.770478 #19007] ERROR -- : /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/secrets.rb:26:in `each' E, [2021-04-24T10:45:35.770494 #19007] ERROR -- : /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/secrets.rb:26:in `each_with_object' E, [2021-04-24T10:45:35.770508 #19007] ERROR -- : /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/secrets.rb:26:in `parse' E, [2021-04-24T10:45:35.770528 #19007] ERROR -- : /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/application.rb:399:in `secrets' E, [2021-04-24T10:45:35.770540 #19007] ERROR -- : /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/application.rb:252:in `env_config' E, [2021-04-24T10:45:35.770550 #19007] ERROR -- : /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/engine.rb:712:in `build_request' E, [2021-04-24T10:45:35.770560 #19007] ERROR -- : /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/application.rb:608:in `build_request' E, [2021-04-24T10:45:35.770586 #19007] ERROR -- : /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/engine.rb:523:in `call' E, [2021-04-24T10:45:35.770618 #19007] ERROR -- : /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/unicorn-5.8.0/lib/unicorn/http_server.rb:634:in `process_client' E, [2021-04-24T10:45:35.770629 #19007] ERROR -- : /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/unicorn-5.8.0/lib/unicorn/http_server.rb:732:in `worker_loop' E, [2021-04-24T10:45:35.770639 #19007] ERROR -- : /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/unicorn-5.8.0/lib/unicorn/http_server.rb:548:in `spawn_missing_workers' E, [2021-04-24T10:45:35.770648 #19007] ERROR -- : /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/unicorn-5.8.0/lib/unicorn/http_server.rb:144:in `start' E, [2021-04-24T10:45:35.770658 #19007] ERROR -- : /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/unicorn-5.8.0/bin/unicorn_rails:209:in `<top (required)>' E, [2021-04-24T10:45:35.770667 #19007] ERROR -- : /home/ryoji/.rbenv/versions/2.6.2/bin/unicorn_rails:23:in `load' E, [2021-04-24T10:45:35.770677 #19007] ERROR -- : /home/ryoji/.rbenv/versions/2.6.2/bin/unicorn_rails:23:in `<main>' E, [2021-04-24T10:45:37.034461 #19006] ERROR -- : app error: undefined method `deep_symbolize_keys' for #<String:0x0000000004f38c30> (NoMethodError) ・・・以下省略

ja.ymlの中身

[config/locales/ja.yml] ja: activerecord: errors: messages: record_invalid: 'バリデーションに失敗しました: %{errors}' restrict_dependent_destroy: has_one: "%{record}が存在しているので削除できません" has_many: "%{record}が存在しているので削除できません" date: abbr_day_names: - 日 - 月 - 火 - 水 - 木 - 金 - 土 abbr_month_names: - - 1月 - 2月 - 3月 - 4月 - 5月 - 6月 - 7月 - 8月 - 9月 - 10月 - 11月 - 12月 day_names: - 日曜日 - 月曜日 - 火曜日 - 水曜日 - 木曜日 - 金曜日 - 土曜日 formats: default: "%Y/%m/%d" long: "%Y年%m月%d日(%a)" short: "%m/%d" month_names: - - 1月 - 2月 - 3月 - 4月 - 5月 - 6月 - 7月 - 8月 - 9月 - 10月 - 11月 - 12月 order: - :year - :month - :day datetime: distance_in_words: about_x_hours: one: 約1時間 other: 約%{count}時間 about_x_months: one: 約1ヶ月 other: 約%{count}ヶ月 about_x_years: one: 約1年 other: 約%{count}年 almost_x_years: one: 1年弱 other: "%{count}年弱" half_a_minute: 30秒前後 less_than_x_seconds: one: 1秒以内 other: "%{count}秒未満" less_than_x_minutes: one: 1分以内 other: "%{count}分未満" over_x_years: one: 1年以上 other: "%{count}年以上" x_seconds: one: 1秒 other: "%{count}秒" x_minutes: one: 1分 other: "%{count}分" x_days: one: 1日 other: "%{count}日" x_months: one: 1ヶ月 other: "%{count}ヶ月" x_years: one: 1年 other: "%{count}年" prompts: second: 秒 minute: 分 hour: 時 day: 日 month: 月 year: 年 errors: format: "%{attribute}%{message}" messages: accepted: を受諾してください blank: を入力してください confirmation: と%{attribute}の入力が一致しません empty: を入力してください equal_to: は%{count}にしてください even: は偶数にしてください exclusion: は予約されています greater_than: は%{count}より大きい値にしてください greater_than_or_equal_to: は%{count}以上の値にしてください inclusion: は一覧にありません invalid: は不正な値です less_than: は%{count}より小さい値にしてください less_than_or_equal_to: は%{count}以下の値にしてください model_invalid: 'バリデーションに失敗しました: %{errors}' not_a_number: は数値で入力してください not_an_integer: は整数で入力してください odd: は奇数にしてください other_than: は%{count}以外の値にしてください present: は入力しないでください required: を入力してください taken: はすでに存在します too_long: は%{count}文字以内で入力してください too_short: は%{count}文字以上で入力してください wrong_length: は%{count}文字で入力してください template: body: 次の項目を確認してください header: one: "%{model}にエラーが発生しました" other: "%{model}に%{count}個のエラーが発生しました" helpers: select: prompt: 選択してください submit: create: 登録する submit: 保存する update: 更新する number: currency: format: delimiter: "," format: "%n%u" precision: 0 separator: "." significant: false strip_insignificant_zeros: false unit: 円 format: delimiter: "," precision: 3 separator: "." significant: false strip_insignificant_zeros: false human: decimal_units: format: "%n %u" units: billion: 十億 million: 百万 quadrillion: 千兆 thousand: 千 trillion: 兆 unit: '' format: delimiter: '' precision: 3 significant: true strip_insignificant_zeros: true storage_units: format: "%n%u" units: byte: バイト eb: EB gb: GB kb: KB mb: MB pb: PB tb: TB percentage: format: delimiter: '' format: "%n%" precision: format: delimiter: '' support: array: last_word_connector: "、" two_words_connector: "、" words_connector: "、" time: am: 午前 formats: default: "%Y年%m月%d日(%a) %H時%M分%S秒 %z" long: "%Y/%m/%d %H:%M" short: "%m/%d %H:%M" pm: 午後

config/application.rbの中身

require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Tempo class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.2 # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers # -- all .rb files in that directory are automatically loaded after loading # the framework and any gems in your application. config.time_zone = 'Tokyo' config.i18n.default_locale = :ja end end

環境

ruby 2.6.2
rails 5.2.5
unicorn 5.8
mysql2 0.5.3

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

railties-5.2.5/lib/rails/secrets.rb:31:in `block in parse'

を見るにsecrets.yml.enc(のproduction以下)になんらかの問題が起きているようです。

投稿2021/04/24 23:53

asm

総合スコア15147

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

moonlight4_6_17

2021/04/25 11:25

ご指摘ありがとうございます。 credential.yml.enc を使用する事にしたのですが、以前からあったsecrets.yml.encが存在していたのが原因だったのかもしれません。 secrets.yml.encを削除したところ上記のエラーは消えました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.46%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問