找不到此错误的根源:OpenSSL :: Cipher :: CipherError

问题描述 投票:0回答:1

[尝试在Rails 6中执行任何操作时遇到错误(例如,数据库迁移,启动服务器,删除数据库等)

我得到的错误是:

ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage
C:/Users/environment/shafrica/config/environment.rb:5:in `<top (required)>'

Caused by:
OpenSSL::Cipher::CipherError:
C:/Users/environment/shafrica/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => db:migrate => db:load_config => environment
(See full trace by running task with --trace)

[我环顾了Stackoverflow(例如thisthis)但是他们没有解决我的问题。我觉得它与我的Postgresql数据库有关,但是我无法得出任何结论。有人有主意吗?

堆栈跟踪:

49: from bin/rails:4:in `<main>'
48: from bin/rails:4:in `require'
47: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/commands.rb:18:in <top (required)>'
46: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/command.rb:46:in `invoke'
45: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/command/base.rb:69:in `perform'
44: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
43: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
42: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
41: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:138:in `perform'
40: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:138:in `tap'
39: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:147:in `block in perform'
38: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:37:in `start'
37: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout'
36: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rack-2.2.2/lib/rack/server.rb:422:in `wrapped_app'
35: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rack-2.2.2/lib/rack/server.rb:249:in `app'
34: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rack-2.2.2/lib/rack/server.rb:349:in `build_app_and_options_from_config'
33: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rack-2.2.2/lib/rack/builder.rb:66:in `parse_file'
32: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rack-2.2.2/lib/rack/builder.rb:105:in `load_file'
31: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rack-2.2.2/lib/rack/builder.rb:116:in `new_from_string'
30: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rack-2.2.2/lib/rack/builder.rb:116:in `eval'
29: from config.ru:3:in `block in <main>'
28: from config.ru:3:in `require_relative'
27: from C:/Users/environment/shafrica/config/environment.rb:5:in `<top (required)>'
26: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/application.rb:363:in `initialize!'
25: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/initializable.rb:60:in `run_initializers'
24: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
23: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
22: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
21: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:347:in `call'
20: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:347:in `each'
19: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
18: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
17: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
16: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
15: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/initializable.rb:61:in `block in run_initializers'
14: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/initializable.rb:32:in `run'
13: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/initializable.rb:32:in `instance_exec'
12: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/devise-4.7.1/lib/devise/rails.rb:37:in `block in <class:Engine>'        
11: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/devise-4.7.1/lib/devise/secret_key_finder.rb:10:in `find'
10: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/devise-4.7.1/lib/devise/secret_key_finder.rb:24:in `key_exists?'         
9: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.1/lib/active_support/core_ext/module/delegation.rb:297:in `method_missing'
8: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.1/lib/active_support/encrypted_configuration.rb:38:in `options'
7: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.1/lib/active_support/encrypted_configuration.rb:33:in `config'
6: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.1/lib/active_support/encrypted_configuration.rb:21:in `read'
5: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.1/lib/active_support/encrypted_file.rb:43:in `read'
4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.1/lib/active_support/encrypted_file.rb:80:in `decrypt'
3: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.1/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify'
2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.1/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify'
1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.1/lib/active_support/message_encryptor.rb:201:in `_decrypt' C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.1/lib/active_support/message_encryptor.rb:201:in `final': OpenSSL::Cipher::CipherError
ruby-on-rails ruby postgresql openssl activesupport
1个回答
0
投票

这通常在凭据设置不正确时发生。在这些情况下

bin/rails credentials:edit (If you have EDITOR set in your $PATH)
or
EDITOR="nano" bin/rails credentials:edit (If you don't have EDITOR set in your $PATH)

这将产生一个新的credentials.yml.enc

应该可以解决错误。

© www.soinside.com 2019 - 2024. All rights reserved.