Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行 rails middleware 报错 #108

Open
ghost opened this issue Feb 29, 2020 · 1 comment
Open

运行 rails middleware 报错 #108

ghost opened this issue Feb 29, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented Feb 29, 2020

配置文件 config/initializers/wx_pay.rb 中的 result = WxPay::Service.get_sandbox_signkey 出错。不知道有什么办法可以判断当前是 rails middleware 在执行,而不请求这个 sandbox_signkey。

错误信息:

Traceback (most recent call last):
	90: from bin/rails:3:in `<main>'
	89: from bin/rails:3:in `load'
	88: from /Users/user/project/bin/spring:15:in `<top (required)>'
	87: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	86: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	85: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
	84: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
	83: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
	82: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
	81: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
	80: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
	79: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
	78: from /Users/user/project/bin/rails:9:in `<top (required)>'
	77: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
	76: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
	75: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
	74: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	73: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
	72: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
	71: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
	70: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
	69: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<main>'
	68: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:46:in `invoke'
	67: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/command/base.rb:65:in `perform'
	66: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
	65: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
	64: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
	63: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/commands/help/help_command.rb:11:in `help'
	62: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:86:in `print_commands'
	61: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:93:in `sorted_groups'
	60: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:93:in `transform_values!'
	59: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:93:in `block in sorted_groups'
	58: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:93:in `flat_map'
	57: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:93:in `each'
	56: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:12:in `printing_commands'
	55: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:42:in `formatted_rake_tasks'
	54: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:33:in `rake_tasks'
	53: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
	52: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/command/actions.rb:28:in `require_environment!'
	51: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:337:in `require_environment!'
	50: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
	49: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
	48: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
	47: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	46: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
	45: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
	44: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
	43: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
	42: from /Users/user/project/config/environment.rb:5:in `<main>'
	41: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!'
	40: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers'
	39: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
	38: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
	37: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
	36: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `call'
	35: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each'
	34: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
	33: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:415:in `each_strongly_connected_component_from'
	32: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:415:in `call'
	31: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:50:in `tsort_each_child'
	30: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:50:in `each'
	29: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
	28: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
	27: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
	26: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	25: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
	24: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers'
	23: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run'
	22: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec'
	21: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:613:in `block in <class:Engine>'
	20: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:613:in `each'
	19: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>'
	18: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:656:in `load_config_initializer'
	17: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications.rb:170:in `instrument'
	16: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:657:in `block in load_config_initializer'
	15: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load'
	14: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
	13: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `block in load'
	12: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
	11: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
	10: from /Users/user/project/config/initializers/wx_pay.rb:8:in `<main>'
	 9: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/wx_pay-0.20.1/lib/wx_pay/service.rb:43:in `get_sandbox_signkey'
	 8: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/wx_pay-0.20.1/lib/wx_pay/service.rb:521:in `invoke_remote'
	 7: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rest-client-2.0.2/lib/restclient/request.rb:52:in `execute'
	 6: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rest-client-2.0.2/lib/restclient/request.rb:145:in `execute'
	 5: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rest-client-2.0.2/lib/restclient/request.rb:715:in `transmit'
	 4: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/2.6.0/net/http.rb:920:in `start'
	 3: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rest-client-2.0.2/lib/restclient/request.rb:725:in `block in transmit'
	 2: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rest-client-2.0.2/lib/restclient/request.rb:809:in `process_result'
	 1: from /Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rest-client-2.0.2/lib/restclient/abstract_response.rb:97:in `return!'
/Users/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rest-client-2.0.2/lib/restclient/abstract_response.rb:223:in `exception_with_response': 302 Found (RestClient::Found)
@oslivan
Copy link
Contributor

oslivan commented May 15, 2020

你可以提交一个 Demo 出来复现一下这个问题,这样方便别人帮你,get_sandbox_signkey 这个就是一个 http 请求,如果在正常情况可以用,执行 rails middleware 也不会有问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant