Comments (10)
把具体错误贴出来。
from weixin_rails_middleware.
/Users/xxx/.rvm/gems/ruby-2.1.4/gems/weixin_rails_middleware-1.3.2/lib/weixin_rails_middleware/adapter/weixin_adapter.rb:59: Weixin signature NotMatch
Completed 500 Internal Server Error in 22ms
ActionView::MissingTemplate (Missing template weixin_rails_middleware/weixin/index with {:locale=>[:"zh-CN"], :formats=>[:html, :text, :js, :css, :ics, :csv, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder, :haml]}. Searched in:
- "/Users/xxx/Codes/rails/douwan/wechat_mall/app/views"
- "/Users/xxx/.rvm/gems/ruby-2.1.4/bundler/gems/rails_admin_jcrop-ea48cb5e4324/app/views"
- "/Users/xxx/.rvm/gems/ruby-2.1.4/gems/ckeditor-4.1.5/app/views"
- "/Users/xxx/.rvm/gems/ruby-2.1.4/bundler/gems/rails_admin-3e77c06e3e44/app/views"
- "/Users/xxx/.rvm/gems/ruby-2.1.4/gems/kaminari-0.17.0/app/views"
- "/Users/xxx/.rvm/gems/ruby-2.1.4/gems/devise-3.5.2/app/views"
):
from weixin_rails_middleware.
weixin_rails_middleware/adapter/weixin_adapter.rb:59: Weixin signature NotMatch
这个才是你要关注的错误信息。
你的签名不匹配。
from weixin_rails_middleware.
应该不是。
我原本是在 V 1.2.6 的时候配置、微信校验可以的了。
然后升级到 V 1.3.2 的时候, 就报错了。
from weixin_rails_middleware.
出1.2.6,当时微信还没有签名加密这一块,1.3.2是添加了签名这一块的。
具体查看:https://github.com/lanrion/weixin_rails_middleware/wiki/msg-encryption-decipher
from weixin_rails_middleware.
在1.3.2, WeixinRailsMiddleware::WeixinController里面的check_weixin_legality ,render check_result
返回的是check_result={ :plain => "xxxx", :status => "200"}
但在1.2.6是 check_result = { :text => "xxxx", :status => "200"}
为什么在1.3.2就返回:plain => "xxxx"而不是text => "xxxx"呢? 我这边就出现了MissTemplate的错误了。只有把plain改成text才不会报错。
按照加密配置 weixin_rails_middleware.rb ,
config.encoding_aes_key = "xxx" config.app_id = "xxx"
但是校验返回:
INFO -- : Parameters: {"signature"=>"xxxxxxxxxxxxx", "echostr"=>"xxxxxxxxxxxx", "timestamp"=>"1487566558", "nonce"=>"1306893847", "weixin_secret_key"=>"xxxxxxxxxxx"}
INFO -- : Completed 500 Internal Server Error in 1ms
FATAL -- :
ActionView::MissingTemplate (Missing template weixin_rails_middleware/weixin/index with {:locale=>[:"zh-CN", :zh], :formats=>[:html, :text, :js, :css, :ics, :csv, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder, :haml]}
from weixin_rails_middleware.
晚点我试试,我使用没有遇到过这。有可能跟Rails的版本有关 :d6b7270
你贴一下的的Rails版本。
from weixin_rails_middleware.
rails -v 4.0.0
from weixin_rails_middleware.
你升级到 1.3.1 版本试试。
from weixin_rails_middleware.
1.3.1 版本 ok的
from weixin_rails_middleware.
Related Issues (20)
- 公众平台消息体签名及加解密方案 HOT 1
- 重复的 `private` ? HOT 3
- weixin_token_string 验证失败 HOT 2
- 转发多客服消息 HOT 3
- 小视频消息 HOT 2
- 对weixin_rails_middleware Rspec测试的时候, WeixinRailsMiddleware::WeixinController#default_url_options 报错 HOT 3
- 自动回复功能 HOT 18
- 取消关注 报错 NoMethodError (undefined method `empty?' for true:TrueClass): HOT 10
- reply_transfer_customer_service_message 未提供指定客服参数 HOT 1
- 要对不同微信回复消息XML结构要实现到自动匹配
- 如何在weixin_controller_decorator.rb文件以外使用reply方法 HOT 2
- Rails 5 貌似不支持。 HOT 4
- 貌似 rails 5 开始不鼓励使用 before_filter 了 HOT 2
- 无法看到log HOT 3
- Rails5.1 貌似会取消这个 before_filter HOT 3
- Filter chain halted as :check_weixin_legality rendered or redirected HOT 3
- message.to_xml的class是Nokogiri::XML::Element Prpcrypt.encrypt加密的时候会undefined method `force_encoding' for #<Nokogiri::XML::Document HOT 1
- Weixin signature NotMatch HOT 4
- NameError: uninitialized constant HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from weixin_rails_middleware.