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

Resumable Upload results in broken pipe #69

Closed
reklov opened this issue Jul 26, 2013 · 11 comments
Closed

Resumable Upload results in broken pipe #69

reklov opened this issue Jul 26, 2013 · 11 comments
Assignees
Labels
🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@reklov
Copy link
Contributor

reklov commented Jul 26, 2013

Hi,

I'm trying to use the resumable upload type to upload videos or thumbnails to youtube.


body = {
    :snippet => {
        :title => 'Testvideo Youtube Publisher TEST',
        :description => 'This is a Testvideo
                          Maybe it helps to solve some Problems.
                          DO NOT PUBLISH!',
        :categoryId => '22'
    },
    :status => {
        :privacyStatus => 'private'
    }
}

upload_file = Google::APIClient::UploadIO.new('/home/volker/Videos/youtube_testvideo.mp4', 'video/*')

response = client.execute({:api_method => youtube_service.videos.insert,
                           :body_object => body,
                           :media =>  upload_file,
                           :parameters => {
                               :uploadType => 'resumable',
                               :part => body.keys.join(','),
                               :alt => 'json',
                               :onBehalfOfContentOwner => '<<ContentOwnere>>',
                               :onBehalfOfContentOwnerChannel => '<<ChannelID>>'
                           },
                           :authorization => authorization
                          } )

response.data.id

But I receive an 'broken pipe'.

Trying the same with the upload type 'multipart' works fine.

volker@vz-ubuntu:~/Sites/pro7/yt-publisher$ bundle exec ruby script/yt-explorer/video_create.rb
D, [2013-07-26T13:37:29.209180 #3139] DEBUG -- : Google::APIClient - Initializing client with options {:application_name=>"yt-publisher", :application_version=>"v1"}
D, [2013-07-26T13:37:29.621135 #3139] DEBUG -- : Google::APIClient::Request Sending API request post https://www.googleapis.com/upload/youtube/v3/videos?alt=json&onBehalfOfContentOwner=<<ContentOwner>>&onBehalfOfContentOwnerChannel=UClj4mQAsWEr3PBJPjl14jrg&part=snippet%2Cstatus&uploadType=resumable {"User-Agent"=>"yt-publisher/v1 google-api-ruby-client/0.7.0 Linux/3.8.0-26-generic", "X-Upload-Content-Type"=>"video/*", "X-Upload-Content-Length"=>"292062370", "Content-Type"=>"application/json", "Authorization"=>"Bearer <<Bearer Code >>", "Cache-Control"=>"no-store"}
D, [2013-07-26T13:37:30.230329 #3139] DEBUG -- : Google::APIClient::Request Result: 200 {"location"=>"https://www.googleapis.com/upload/youtube/v3/videos?alt=json&onBehalfOfContentOwner=<<ContentOwner>>&onBehalfOfContentOwnerChannel=UClj4mQAsWEr3PBJPjl14jrg&part=snippet%2Cstatus&uploadType=resumable&upload_id=AEnB2UoO3NPbUzEud1SIgFIcAZ4X40r5d28y0zPGwRk0YEQdQanXu8C5JB7Z4tHJh5zt1uAqzf9SMxxhqubaxPo8KN5yi1cx_g", "date"=>"Fri, 26 Jul 2013 11:37:30 GMT", "server"=>"HTTP Upload Server Built on Jul 21 2013 19:20:38 (1374459638)", "content-length"=>"0", "content-type"=>"text/html; charset=UTF-8", "connection"=>"close"}
D, [2013-07-26T13:37:30.231483 #3139] DEBUG -- : Google::APIClient::Request Sending upload body
D, [2013-07-26T13:37:30.233920 #3139] DEBUG -- : Google::APIClient::ResumableUpload Sending API request post https://www.googleapis.com/upload/youtube/v3/videos?alt=json&onBehalfOfContentOwner=<<ContentOwner>>&onBehalfOfContentOwnerChannel=UClj4mQAsWEr3PBJPjl14jrg&part=snippet%2Cstatus&uploadType=resumable&upload_id=AEnB2UoO3NPbUzEud1SIgFIcAZ4X40r5d28y0zPGwRk0YEQdQanXu8C5JB7Z4tHJh5zt1uAqzf9SMxxhqubaxPo8KN5yi1cx_g {"User-Agent"=>"yt-publisher/v1 google-api-ruby-client/0.7.0 Linux/3.8.0-26-generic", "X-Upload-Content-Type"=>"video/*", "X-Upload-Content-Length"=>"292062370", "Content-Type"=>"video/*", "Content-Length"=>"292062370", "Content-Range"=>"bytes 0-292062369/292062370", "Authorization"=>"Bearer <<Bearer Code >>", "Cache-Control"=>"no-store"}
/home/volker/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/openssl/buffering.rb:318:in `syswrite': Broken pipe (Errno::EPIPE)
    from /home/volker/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/openssl/buffering.rb:318:in `do_write'
    from /home/volker/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/openssl/buffering.rb:336:in `write'
    from /home/volker/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http/generic_request.rb:202:in `copy_stream'
    from /home/volker/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http/generic_request.rb:202:in `send_request_with_body_stream'
    from /home/volker/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http/generic_request.rb:132:in `exec'
    from /home/volker/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1404:in `block in transport_request'
    from /home/volker/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1403:in `catch'
    from /home/volker/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1403:in `transport_request'
    from /home/volker/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1376:in `request'
    from /home/volker/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1369:in `block in request'
    from /home/volker/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:852:in `start'
    from /home/volker/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1367:in `request'
    from /home/volker/.rvm/gems/ruby-2.0.0-p247/gems/faraday-0.9.0.rc5/lib/faraday/adapter/net_http.rb:75:in `perform_request'
    from /home/volker/.rvm/gems/ruby-2.0.0-p247/gems/faraday-0.9.0.rc5/lib/faraday/adapter/net_http.rb:38:in `call'
    from /home/volker/Sites/sources/google-api-ruby-client/lib/google/api_client/request.rb:165:in `send'
    from /home/volker/Sites/sources/google-api-ruby-client/lib/google/api_client/request.rb:176:in `send'
    from /home/volker/Sites/sources/google-api-ruby-client/lib/google/api_client.rb:578:in `execute'
    from script/yt-explorer/video_create.rb:32:in `<main>'
@aurels
Copy link

aurels commented Oct 4, 2013

Hello,

I seem to have the same issue here. But it doesn't work with multipart neither. Any chance you found the reason ?

Thanks.

@alexvodovoz
Copy link

+1 on not being able to get resumable uploads working.

@seanhuber
Copy link

+1 ditto; doesn't even work for a small file.

@forest
Copy link

forest commented Jul 31, 2014

+1

@HaoCHEN11
Copy link

+1, had the same issue with resumable uploading.

@towens
Copy link

towens commented Sep 16, 2014

+1 Same here 'multipart' succeeds, 'resumable' results in Errno::EPIPE (Broken pipe):

@towens
Copy link

towens commented Sep 16, 2014

@sqrrrl sqrrrl removed this from the 0.7.2 milestone Dec 17, 2014
@khacanh
Copy link

khacanh commented Dec 18, 2014

@towens thanks for the tip. works for me

Faraday.default_adapter = :httpclient

@phbernard
Copy link

Thank you @towens! This issue was closed but I encountered it and your fix worked!

@towens
Copy link

towens commented Jun 12, 2015

@phbernard Vnice!

@kidlab
Copy link

kidlab commented Dec 3, 2015

If you're using Faraday >= 0.9.2 and have trouble with this error Zlib::GzipFile::Error: not in gzip format, you might need to apply this monkey patch to work around:

Faraday.default_adapter = :httpclient

if Faraday::VERSION >= '0.9.2'
  # Only add the following statement if using Faraday >= 0.9.2
  # Override gzip middleware with no-op for httpclient
  # See: https://github.com/GoogleCloudPlatform/gcloud-ruby/issues/367
  Faraday::Response.register_middleware(gzip: Faraday::Response::Middleware)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests