[英]Rails: ActiveSupport::MessageEncryptor::InvalidMessage
[英]Rails 5.2.0 load application error: ActiveSupport::MessageEncryptor::InvalidMessage (ActiveSupport::MessageEncryptor::InvalidMessage
我已經嘗試了解決方案,這些解決方案在以下鏈接中發布:
使用master.key Digital Ocean部署的Rails 5.2:ActiveSupport :: MessageEncryptor :: InvalidMessage:ActiveSupport :: MessageEncryptor :: InvalidMessage Rails部署Digitalocean ActiveSupport :: MessageEncryptor :: InvalidMessage: 嘗試在日志中獲取錯誤ActiveSupport :: MessageEncryptor :: InvalidMessage部署Rails 5.2.0 App
,但沒有人適合我的情況。
我的環境是:
secrets.yml
獲取secrets.yml
。 config/master.key
和config/credentials.yml.enc
。 這是可部署的,但無法通過瀏覽器視圖使用。 由於提交錯誤,我曾經重新生成master.key
和credentials.yml.enc
master.key
文件,並推送到git-remote存儲庫。 capistrano
和rails-capistrano gem
部署 對於第二個Rails 5.2.0應用程序,我使用gem dotrails
將SECRET_KEY_BASE = '<SECRET_KEY>'
放入.env
文件中,該文件從shared/
目錄軟鏈接到當前版本的遠程rails應用程序的主目錄,並添加一條語句: config.require_master_key = true
用於config/environments/production.rb
文件。
我已傳輸的文件credentials.yml.enc
和master.key
從本地機器shared/config/
在遠程計算機的滑軌應用程序目錄。 另外,我將文件.env
放到遠程計算機的shared/
目錄中。
我還將文件列表添加到config/deploy.rb
的linked_files
:
append :linked_files, "config/database.yml", "config/credentials.yml.enc", "config/master.key", ".env" set :rvm_custom_path, '/usr/local/rvm' set :rvm_ruby_version, '2.4.2@blogapp-rails-5.2.0-ruby-2.4.2'
我試圖將第二個Rails 5.2.0應用程序部署到遠程機器,但它仍然可以部署,並且無法通過瀏覽器視圖工作。 我希望有人可以解決這種情況。 謝謝。
以下是加載Rails應用程序時錯誤消息的一部分, 詳細消息在我的保管箱鏈接中 :
Error: The application encountered the following error: ActiveSupport::MessageEncryptor::InvalidMessage (ActiveSupport::MessageEncryptor::InvalidMessage)
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:206:in `rescue in _decrypt'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:184:in `_decrypt'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_file.rb:79:in `decrypt'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_file.rb:42:in `read'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:21:in `read'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:33:in `config'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:38:in `options'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/core_ext/module/delegation.rb:271:in `method_missing'
(erb):12:in `'
/usr/share/rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/erb.rb:896:in `eval'
/usr/share/rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/erb.rb:896:in `result'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activestorage-5.2.0/lib/active_storage/engine.rb:81:in `block (2 levels) in '
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:51:in `each'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activestorage-5.2.0/app/models/active_storage/blob.rb:206:in `'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activestorage-5.2.0/app/models/active_storage/blob.rb:16:in `'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:370:in `block in require_or_load'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:37:in `block in load_interlock'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies/interlock.rb:13:in `loading'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:37:in `load_interlock'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:348:in `require_or_load'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:326:in `depend_on'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `depend_on'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:242:in `require_dependency'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:478:in `block (2 levels) in eager_load!'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:477:in `each'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:477:in `block in eager_load!'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:475:in `each'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:475:in `eager_load!'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:356:in `eager_load!'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application/finisher.rb:69:in `each'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application/finisher.rb:69:in `block in '
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `instance_exec'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `run'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:61:in `block in run_initializers'
/usr/share/rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
/usr/share/rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/usr/share/rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
/usr/share/rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
/usr/share/rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:347:in `each'
/usr/share/rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:347:in `call'
/usr/share/rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
/usr/share/rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
/usr/share/rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:60:in `run_initializers'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application.rb:361:in `initialize!'
/var/www/blogApp/releases/20180805160423/config/environment.rb:5:in `'
config.ru:3:in `require_relative'
config.ru:3:in `block in '
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/rack-2.0.5/lib/rack/builder.rb:55:in `instance_eval'
/var/www/blogApp/shared/bundle/ruby/2.4.0/gems/rack-2.0.5/lib/rack/builder.rb:55:in `initialize'
config.ru:1:in `new'
config.ru:1:in `'
/usr/share/passenger/helper-scripts/rack-preloader.rb:101:in `eval'
/usr/share/passenger/helper-scripts/rack-preloader.rb:101:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:189:in `block in '
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:380:in `run_block_and_record_step_progress'
/usr/share/passenger/helper-scripts/rack-preloader.rb:188:in `'
/usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `'
環境變量:
APACHE_PID_FILE = /var/run/apache2/apache2.pid
rvm_bin_path = /usr/share/rvm/bin
PASSENGER_SPAWN_WORK_DIR = /tmp/passenger.spawn.XXXX5nnkfO
GEM_HOME = /var/www/blogApp/shared/bundle/ruby/2.4.0
SSL_TLS_SNI = yhblog.csie.io
APACHE_RUN_USER = www-data
SHELL = /bin/bash
IRBRC = /usr/share/rvm/rubies/ruby-2.4.2/.irbrc
PYTHONUNBUFFERED = 1
MY_RUBY_HOME = /usr/share/rvm/rubies/ruby-2.4.2
USER = xxxxuser
HTTPS = on
_system_type = Linux
rvm_path = /usr/share/rvm
IN_PASSENGER = 1
RACK_ENV = production
PASSENGER_USE_FEEDBACK_FD = true
rvm_prefix = /usr/share
APACHE_LOG_DIR = /var/log/apache2
PATH = /var/www/blogApp/shared/bundle/ruby/2.4.0/bin:/home/xxxxuser/.rvm/gems/ruby-2.4.2@rails5.2.0/bin:/home/xxxxuser/.rvm/gems/ruby-2.4.2@global/bin:/usr/share/rvm/rubies/ruby-2.4.2/bin:/usr/local/rvm/bin:/home/xxxxuser/.rvm/wrappers/ruby-2.4.2@rails5.2.0/bin:/home/xxxxuser/.rvm/gems/ruby-2.4.2/bin:/usr/share/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
WSGI_ENV = production
PWD = /var/www/blogApp/current
APACHE_RUN_GROUP = www-data
LANG = C
NODE_PATH = /usr/share/passenger/node
_system_arch = x86_64
NODE_ENV = production
_system_version = 14.04
rvm_version = 1.29.4 (manual)
HOME = /home/xxxxuser
SHLVL = 0
RAILS_ENV = production
rvm_ruby_string = ruby-2.4.2
SERVER_SOFTWARE = Apache/2.4.7 (Ubuntu) Phusion_Passenger/5.3.3
LOGNAME = xxxxuser
GEM_PATH =
PASSENGER_APP_ENV = production
rvmsudo_secure_path = 1
rvm_delete_flag = 0
APACHE_LOCK_DIR = /var/lock/apache2
APACHE_RUN_DIR = /var/run/apache2
RUBY_VERSION = ruby-2.4.2
_system_name = Ubuntu
rvm_silence_path_mismatch_check_flag = 1
BUNDLER_ORIG_BUNDLE_BIN_PATH = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_BUNDLE_GEMFILE = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_BUNDLER_ORIG_MANPATH = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_BUNDLER_VERSION = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_GEM_HOME = /home/xxxxuser/.rvm/gems/ruby-2.4.2@rails5.2.0
BUNDLER_ORIG_GEM_PATH = /home/xxxxuser/.rvm/gems/ruby-2.4.2@rails5.2.0:/home/xxxxuser/.rvm/gems/ruby-2.4.2@global
BUNDLER_ORIG_MANPATH = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_PATH = /home/xxxxuser/.rvm/gems/ruby-2.4.2@rails5.2.0/bin:/home/xxxxuser/.rvm/gems/ruby-2.4.2@global/bin:/usr/share/rvm/rubies/ruby-2.4.2/bin:/usr/local/rvm/bin:/home/xxxxuser/.rvm/wrappers/ruby-2.4.2@rails5.2.0/bin:/home/xxxxuser/.rvm/gems/ruby-2.4.2/bin:/home/xxxxuser/.rvm/gems/ruby-2.4.2@global/bin:/usr/share/rvm/rubies/ruby-2.4.2/bin:/usr/share/rvm/bin:/home/xxxxuser/.rvm/gems/ruby-2.4.2/bin:/home/xxxxuser/.rvm/gems/ruby-2.4.2@global/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
BUNDLER_ORIG_RB_USER_INSTALL = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_RUBYLIB = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_RUBYOPT = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLE_BIN_PATH = /home/xxxxuser/.rvm/gems/ruby-2.4.2@global/gems/bundler-1.16.3/exe/bundle
BUNDLE_GEMFILE = /var/www/blogApp/releases/20180805160423/Gemfile
BUNDLER_VERSION = 1.16.3
RUBYOPT = -rbundler/setup
RUBYLIB = /usr/share/rvm/rubies/ruby-2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.3/lib
SECRET_KEY_BASE = 6e6b750cfcd6dd788a29cf7fd9a2d8722e207d3f2f0e90eec5a72e318ba719386126ee3513d53e3b3727057213b3aa9c43a96b08f62de0df1c0def9a9202f72b
RAILS_MASTER_KEY = 25a3611d36b773ca1b03277a02cf43f8
活化寶石:
did_you_mean => 1.1.0
bundler => 1.16.3
io-console => 0.4.6
rake => 12.3.1
concurrent-ruby => 1.0.5
i18n => 1.0.1
minitest => 5.11.3
thread_safe => 0.3.6
tzinfo => 1.2.5
activesupport => 5.2.0
builder => 3.2.3
erubi => 1.7.1
mini_portile2 => 2.3.0
nokogiri => 1.8.4
rails-dom-testing => 2.0.3
crass => 1.0.4
loofah => 2.2.2
rails-html-sanitizer => 1.0.4
actionview => 5.2.0
rack => 2.0.5
rack-test => 1.1.0
actionpack => 5.2.0
nio4r => 2.3.1
websocket-extensions => 0.1.3
websocket-driver => 0.7.0
actioncable => 5.2.0
globalid => 0.4.1
activejob => 5.2.0
mini_mime => 1.0.0
mail => 2.7.0
actionmailer => 5.2.0
activemodel => 5.2.0
arel => 9.0.0
activerecord => 5.2.0
mimemagic => 0.3.2
marcel => 0.3.2
activestorage => 5.2.0
execjs => 2.7.0
autoprefixer-rails => 9.0.2
bcrypt => 3.1.11
msgpack => 1.2.4
bootsnap => 1.3.1
popper_js => 1.14.3
rb-fsevent => 0.10.3
ffi => 1.9.25
rb-inotify => 0.9.10
sass-listen => 4.0.0
sass => 3.5.7
bootstrap => 4.1.3
coffee-script-source => 1.12.2
coffee-script => 2.4.1
method_source => 0.9.0
thor => 0.20.0
railties => 5.2.0
coffee-rails => 4.2.2
orm_adapter => 0.5.0
responders => 2.4.0
warden => 1.2.7
devise => 4.4.3
dotenv => 2.3.0
dotenv-rails => 2.3.0
multi_json => 1.13.1
jbuilder => 2.7.0
jquery-rails => 4.3.3
kaminari-core => 1.1.1
kaminari-actionview => 1.1.1
kaminari-activerecord => 1.1.1
kaminari => 1.1.1
pg => 1.0.0
puma => 3.12.0
sprockets => 3.7.2
sprockets-rails => 3.2.1
rails => 5.2.0
tilt => 2.0.8
sass-rails => 5.0.7
sassc => 1.12.1
sqlite3 => 1.3.13
turbolinks-source => 5.1.0
turbolinks => 5.1.1
uglifier => 4.1.16
經過研究,我承認我的答案甚至都沒有,而且是錯誤的。 我猜這個鍵必須設置。 什么secrets.yml包含? 也許您的第二個應用程序嘗試使用第一個應用程序的秘密
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.