Eric-Guo / wechat

API, command and message handling for WeChat in Rails
MIT License
1.31k stars 371 forks source link

Error when uploading video material #101

Closed lldong closed 8 years ago

lldong commented 8 years ago

This error only occur when upload video material. Here is the stack trace:

material_add video /path/to/sample.mp4
Using rails project config/wechat.yml default setting...
/Users/lldong/Workspace/rails-projects/wechat-admin/.gem/ruby/2.3.0/gems/wechat-0.7.5/lib/wechat/client.rb:61:in `block in request': media data missing hint: [v.SDpa0158e297](41005) (Wechat::ResponseError)
    from /Users/lldong/Workspace/rails-projects/wechat-admin/.gem/ruby/2.3.0/gems/wechat-0.7.5/lib/wechat/client.rb:87:in `parse_response'
    from /Users/lldong/Workspace/rails-projects/wechat-admin/.gem/ruby/2.3.0/gems/wechat-0.7.5/lib/wechat/client.rb:48:in `request'
    from /Users/lldong/Workspace/rails-projects/wechat-admin/.gem/ruby/2.3.0/gems/wechat-0.7.5/lib/wechat/client.rb:29:in `post_file'
    from /Users/lldong/Workspace/rails-projects/wechat-admin/.gem/ruby/2.3.0/gems/wechat-0.7.5/lib/wechat/api_base.rb:39:in `block in post_file'
    from /Users/lldong/Workspace/rails-projects/wechat-admin/.gem/ruby/2.3.0/gems/wechat-0.7.5/lib/wechat/api_base.rb:45:in `with_access_token'
    from /Users/lldong/Workspace/rails-projects/wechat-admin/.gem/ruby/2.3.0/gems/wechat-0.7.5/lib/wechat/api_base.rb:38:in `post_file'
    from /Users/lldong/Workspace/rails-projects/wechat-admin/.gem/ruby/2.3.0/gems/wechat-0.7.5/lib/wechat/api.rb:101:in `material_add'
    from /Users/lldong/Workspace/rails-projects/wechat-admin/.gem/ruby/2.3.0/gems/wechat-0.7.5/bin/wechat:344:in `material_add'
    from /Users/lldong/Workspace/rails-projects/wechat-admin/.gem/ruby/2.3.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /Users/lldong/Workspace/rails-projects/wechat-admin/.gem/ruby/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/lldong/Workspace/rails-projects/wechat-admin/.gem/ruby/2.3.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /Users/lldong/Workspace/rails-projects/wechat-admin/.gem/ruby/2.3.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /Users/lldong/Workspace/rails-projects/wechat-admin/.gem/ruby/2.3.0/gems/wechat-0.7.5/bin/wechat:425:in `<top (required)>'
    from /Users/lldong/Workspace/rails-projects/wechat-admin/.gem/ruby/2.3.0/bin/wechat:23:in `load'
    from /Users/lldong/Workspace/rails-projects/wechat-admin/.gem/ruby/2.3.0/bin/wechat:23:in `<main>'
Eric-Guo commented 8 years ago

There once having a bug, which affected upload file, but already fix after v0.7.1, so above error should only relative with network condition/tencent server, also can not reproduce via below command:

eric@cvpbsid01:~$ wechat material_add video ripple.mp4
{"errcode"=>0, "errmsg"=>"ok", "media_id"=>"2OARWAaAHsOEsDj_EjIRuukNZ4H8MmSxENCpKMOO8p-NQo1dWw1TBpnvYiI9AsmCfkzOt6MzQ_YSxQobIW6pACQ"}
eric@cvpbsid01:~$ ls -lhta ripple.mp4
-rw-rw-r-- 1 eric eric 5.4M Mar 19 23:30 ripple.mp4
lldong commented 8 years ago

@Eric-Guo There seems to be a problem with Wechat's developer test account/server.