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

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

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby on Rails

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

Q&A

解決済

1回答

1843閲覧

git push herokuが通らなくなってしまいました。

pandama09396862

総合スコア6

Ruby on Rails

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

0グッド

0クリップ

投稿2020/07/29 12:41

編集2020/07/29 13:01

前提・実現したいこと

heroku上でpostgresqlを使ったrailsアプリを実装したい

railsアプリを現在作成中です。当初postgresをdbに採用しproduction環境でheroku実装していました。途中で練習のためにmysql環境に変更しようとしたところ、エラー多発し、postgresqlに戻そうとしたがgit push herokuが通らなくなってしまいました。

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

このようなエラーがでます。

$ git push heroku ・ ・ ・ remote: Compressing source files... done. remote: Building source: remote: remote: -----> Ruby app detected remote: -----> Installing bundler 1.17.3 remote: -----> Removing BUNDLED WITH version in the Gemfile.lock remote: -----> Compiling Ruby/Rails remote: -----> Using Ruby version: ruby-2.6.5 remote: -----> Installing dependencies using bundler 1.17.3 remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment remote: Fetching gem metadata from https://rubygems.org/............ ・ ・ ・ remote: Using devise 4.7.2 remote: Using devise-i18n 1.9.1 remote: Bundle complete! 42 Gemfile dependencies, 99 gems now installed. remote: Gems in the groups development and test were not installed. remote: Bundled gems are installed into `./vendor/bundle` remote: Post-install message from i18n: remote: remote: HEADS UP! i18n 1.1 changed fallbacks to exclude default locale. remote: But that may break your application. remote: remote: If you are upgrading your Rails application from an older version of Rails: remote: remote: Please check your Rails app for 'config.i18n.fallbacks = true'. remote: If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be remote: 'config.i18n.fallbacks = [I18n.default_locale]'. remote: If not, fallbacks will be broken in your app by I18n 1.1.x. remote: remote: If you are starting a NEW Rails application, you can ignore this notice. remote: remote: For more info see: remote: https://github.com/svenfuchs/i18n/releases/tag/v1.1.0 remote: remote: Removing bootsnap (1.4.6) remote: Removing bcrypt (3.1.13) remote: Removing i18n (1.8.4) remote: Bundle completed (5.14s) remote: Cleaning up the bundler cache. remote: -----> Installing node-v12.16.2-linux-x64 remote: -----> Detecting rake tasks remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: rake aborted! remote: NoMethodError: undefined method `deep_symbolize_keys' for #<String:0x0000558fb3325648> remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/secrets.rb:31:in `block in parse' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/secrets.rb:26:in `each' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/secrets.rb:26:in `each_with_object' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/secrets.rb:26:in `parse' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/application.rb:399:in `secrets' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/devise-4.7.2/lib/devise/secret_key_finder.rb:12:in `find' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/devise-4.7.2/lib/devise/rails.rb:37:in `block in <class:Engine>' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:32:in `instance_exec' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:32:in `run' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:61:in `block in run_initializers' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:60:in `run_initializers' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/application.rb:361:in `initialize!' remote: /tmp/build_c2106e1f/config/environment.rb:7:in `<main>' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/application.rb:337:in `require_environment!' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/application.rb:520:in `block in run_tasks_blocks' remote: /tmp/build_c2106e1f/vendor/bundle/ruby/2.6.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define' remote: Tasks: TOP => environment remote: (See full trace by running task with --trace) remote: remote: ! remote: ! Precompiling assets failed. remote: ! remote: ! Push rejected, failed to compile Ruby app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to vbapp0108. remote: To https://git.heroku.com/@@@.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/@@@.git'

該当のソースコード

gemfile

1source "https://rubygems.org" 2git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 4ruby "2.6.5" 5gem "bootsnap", ">= 1.1.0", require: false 6gem "coffee-rails", "~> 4.2" 7gem "jbuilder", "~> 2.5" 8gem "puma", "~> 3.11" 9gem "rails", "~> 5.2.4" 10gem "sass-rails", "~> 5.0" 11gem "turbolinks", "~> 5" 12gem "uglifier", ">= 1.3.0" 13gem "websocket-extensions" 14gem "faker" 15gem "mini_magick" 16gem "ransack" 17gem "kaminari" 18gem "dotenv-rails" 19gem "font-awesome-sass", "~> 5.4.1" 20gem "devise" 21gem "omniauth-twitter" 22gem "omniauth-facebook" 23gem "omniauth-google-oauth2" 24gem "devise-i18n" 25gem "rails-i18n", "~> 5.1" 26gem "bootstrap", "~> 4.4.1" 27gem "devise-bootstrap-views", "~> 1.0" 28gem "jquery-rails" 29 30group :development, :test do 31 gem "byebug", platforms: %i(mri mingw x64_mingw) 32 gem "factory_bot_rails" 33 gem "pry-rails" 34 gem "rspec-rails" 35 gem "sqlite3", group: [:development, :test] 36end 37 38group :development do 39 gem "bullet" 40 gem "listen", ">= 3.0.5", "< 3.2" 41 gem "rubocop", require: false 42 gem "rubocop-airbnb" 43 gem "rubocop-rails" 44 gem "spring" 45 gem "spring-commands-rspec" 46 gem "spring-watcher-listen", "~> 2.0.0" 47 gem "web-console", ">= 3.3.0" 48end 49 50group :test do 51 gem "capybara", ">= 2.15" 52 gem "chromedriver-helper" 53 gem "selenium-webdriver" 54end 55 56group :production do 57 gem "pg" 58end

configdatabase

1 2 3# SQLite version 3.x 4# gem install sqlite3 5# 6# Ensure the SQLite 3 gem is defined in your Gemfile 7# gem 'sqlite3' 8# 9default: &default 10 adapter: sqlite3 11 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 12 timeout: 5000 13 14development: 15 <<: *default 16 database: db/development.sqlite3 17 18# Warning: The database defined as "test" will be erased and 19# re-generated from your development database when you run "rake". 20# Do not set this db to the same as development or production. 21test: 22 <<: *default 23 database: db/test.sqlite3 24 25production: 26 <<: *default 27 adapter: postgresql 28 encoding: unicode 29 pool: 5 30

secrets

1 2require "yaml" 3require "active_support/message_encryptor" 4require "active_support/core_ext/string/strip" 5 6module Rails 7 # Greatly inspired by Ara T. Howard's magnificent sekrets gem. ???? 8 class Secrets # :nodoc: 9 class MissingKeyError < RuntimeError 10 def initialize 11 super(<<-end_of_message.squish) 12 Missing encryption key to decrypt secrets with. 13 Ask your team for your master key and put it in ENV["RAILS_MASTER_KEY"] 14 end_of_message 15 end 16 end 17 18 @cipher = "aes-128-gcm" 19 @root = File # Wonky, but ensures `join` uses the current directory. 20 21 class << self 22 attr_writer :root 23 24 def parse(paths, env:) 25 paths.each_with_object(Hash.new) do |path, all_secrets| 26 require "erb" 27 28 secrets = YAML.load(ERB.new(preprocess(path)).result) || {} 29 all_secrets.merge!(secrets["shared"].deep_symbolize_keys) if secrets["shared"] 30 all_secrets.merge!(secrets[env].deep_symbolize_keys) if secrets[env] 31 end 32 end 33 end 34 end 35end 36

どんな些細な情報でも構いません。ご指摘いただけると幸いです。

試したこと

上記ログのエラーメッセージに記載されている
gemfile.lockを削除してもう一度bundle install --without productionし直す.

remote: NoMethodError: undefined method `deep_symbolize_keys' for #<String:0x0000558fb3325648>

この部分が怪しいと思ったのですが過去の記事を参考に色々といじってみたのですが改善せずです。。

補足情報(FW/ツールのバージョンなど)

ここにより詳細な情報を記載してください。

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

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

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

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

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

guest

回答1

0

ベストアンサー

/config/environment.rb でハッシュを期待している位置に文字列を渡しています

参考: Rake aborted - NoMethodError: undefined methor 'deep_symbolize_keys'

you're probably passing a string in a line of your /config/environment.rb somewhere
where it's expecting a hash

投稿2020/07/29 13:55

y_shinoda

総合スコア3272

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

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

pandama09396862

2020/07/30 11:37

ありがとうございます。secrets.ymlのfileの中に文字列が含まれていることが原因でした。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問