現在世界一丁寧なAWS解説。EC2を利用して、RailsアプリをAWSにあげるまでを参考にAWSを勉強しています。
実現したいこと
サーバー環境でEDITOR=vim bin/rails credentials:editを実行して新たにmaster.keyとcredentials.yml.encを作成したいです。
発生している問題・エラーメッセージ
サーバー環境でEDITOR=vim bin/rails credentials:editをすると
`key=': key must be 16 bytes (ArgumentError)
全体のerror文
Traceback (most recent call last): 35: from bin/rails:3:in `<main>' 34: from bin/rails:3:in `load' 33: from /var/www/rails/ToDoGame/backend/bin/spring:15:in `<top (required)>' 32: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require' 31: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require' 30: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>' 29: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load' 28: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/bin/spring:49:in `<top (required)>' 27: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/client.rb:30:in `run' 26: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call' 25: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call' 24: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load' 23: from /var/www/rails/ToDoGame/backend/bin/rails:9:in `<top (required)>' 22: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `require' 21: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:291:in `load_dependency' 20: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `block in require' 19: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' 18: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' 17: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' 16: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' 15: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' 14: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.2/lib/rails/commands.rb:18:in `<main>' 13: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.2/lib/rails/command.rb:46:in `invoke' 12: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.2/lib/rails/command/base.rb:69:in `perform' 11: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch' 10: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command' 9: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run' 8: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.2/lib/rails/commands/credentials/credentials_command.rb:30:in `edit' 7: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.2/lib/rails/commands/credentials/credentials_command.rb:62:in `ensure_credentials_have_been_added' 6: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.2/lib/rails/generators/rails/credentials/credentials_generator.rb:30:in `add_credentials_file_silently' 5: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.2/lib/active_support/encrypted_configuration.rb:29:in `write' 4: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.2/lib/active_support/encrypted_file.rb:50:in `write' 3: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.2/lib/active_support/encrypted_file.rb:76:in `encrypt' 2: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.2/lib/active_support/message_encryptor.rb:151:in `encrypt_and_sign' 1: from /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.2/lib/active_support/message_encryptor.rb:169:in `_encrypt' /home/kazuki/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.2/lib/active_support/message_encryptor.rb:169:in `key=': key must be 16 bytes (ArgumentError)
が表示されます。
試したこと
ローカル環境では、rails cでRails.application.credentials.secret_key_baseを確認しても何も問題なく表示されるので、ローカルのmaster.keyとcredentials.yml.encをコピーしてサーバー環境でvi config/master.keyとvi config/credentials.yml.encで作成したところにローカルのものを貼り付けても
ActiveSupport::MessageEncryptor::InvalidMessage (ActiveSupport::MessageEncryptor::InvalidMessage)
のエラーが出ます。
サーバー環境でだけEDITOR=vim bin/rails credentials:editを実行したときに`key=': key must be 16 bytes (ArgumentError)が表示されるので、、、。何か設定を壊してしまっているのか心配です。解決策をご存知の方は是非教えていただきたいです、、、m(_ _)m
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。