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

No method error on Heroku. #29

Closed
george-carlin opened this issue Oct 28, 2013 · 5 comments
Closed

No method error on Heroku. #29

george-carlin opened this issue Oct 28, 2013 · 5 comments

Comments

@george-carlin
Copy link

Hi,

I made a simple Sinatra app that uses this Gem. It runs fine on localhost, but when I deploy to Heroku I get the error NoMethodError - undefined method 'write_buffer' for Zip::ZipOutputStream:Class: which is being raised by the line /app/vendor/bundle/ruby/2.0.0/gems/passbook-0.2.1/lib/passbook/pkpass.rb:122:in outputZip.

Any idea what the cause of this could be?

I posted on StackOverflow with the same problem, more detailed description here

@lgleasain
Copy link
Collaborator

This could be one of two things. #1, there is a rubyzip update pull request that I haven't had time to look at that could be the culprit. #2 something else.

Most apps that I have written for this have targeted Heroku, but something may have changed and we hadn't gone to 2.0 at the time. Can you share some of the relative snippets in your app too? This is the first issue we have had in a while....but I will look at it today.

@george-carlin
Copy link
Author

Here's the method that causes the problem. (Just trying to serve a pkpass file from a static url, like I said it's only a barebones app at the moment.)

 get "/v1/passes/#{PASS_TYPE_IDENTIFIER}/12345" do
   pass = File.read File.join("files", "pass.json")
   passbook = Passbook::PKPass.new pass
   passbook.addFiles [
     "files/logo.png", "files/logo@2x.png", "files/icon.png",
     "files/icon@2x.png", "files/strip.png", "files/strip@2x.png"]
   response['Content-Type'] = 'application/vnd.apple.pkpass'
   attachment 'mypass.pkpass'
   passbook.stream.string
 end

at the top I'm requiring a file which contains:

Passbook.configure do |passbook|
  passbook.wwdc_cert = File.join "certs", "WWDR.pem"
  passbook.p12_key   = File.join "certs", "passkey.pem"
  passbook.p12_certificate = File.join "certs", "passcertificate.pem"
  passbook.p12_password = (password)
end

@lgleasain
Copy link
Collaborator

I think this might be related to the changes with RubyZip. Can I see your Gemfile.lock ?

@george-carlin
Copy link
Author

    GEM
      remote: https://rubygems.org/
      specs:
        active_support (3.0.0)
          activesupport (= 3.0.0)
        activesupport (3.0.0)
        grocer (0.4.1)
        passbook (0.2.1)
          grocer
          rubyzip
        rack (1.5.2)
        rack-protection (1.5.1)
          rack
        rubyzip (1.0.0)
        sinatra (1.4.4)
          rack (~> 1.4)
          rack-protection (~> 1.4)
          tilt (~> 1.3, >= 1.3.4)
        tilt (1.4.1)
        zip (2.0.2)

    PLATFORMS
      ruby

    DEPENDENCIES
      active_support
      passbook
      rubyzip
      sinatra
      zip

@lgleasain
Copy link
Collaborator

It looks like your issue is related to Rubyzip. Try updating your passbook gem to the latest one and let me know if you have any problems.

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

2 participants