Skip to content

Bundler Error during Deployment - undefined method `size' for nil:NilClass in wkhtmltopdf-binary gem #166

@muhammadawais05

Description

@muhammadawais05

Issue Summary:
I encountered an issue while deploying a Rails application using Capistrano. The deployment process fails during the bundler:install task with the following error:

Exception while verifying /path/to/bundle/cache/wkhtmltopdf-binary-0.12.6.6.gem
NoMethodError: undefined method `size' for nil:NilClass
@READ += ret.size

Environment:

Ruby version: 3.1.2
Bundler version: 2.4.22

Steps to Reproduce:

Clone the repository.
Run cap production deploy to deploy the Rails application.
Expected Behavior:
The deployment process should complete successfully without errors.

Actual Behavior:
The deployment fails with the mentioned error related to the wkhtmltopdf-binary gem.

Additional Information:

Gemfile content:

source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.1.2"

# Use Sass to process CSS
gem "sassc-rails"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.8"

gem 'activeadmin'
gem 'devise'
gem 'pundit'

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"

# Use postgresql as the database for Active Record
gem "pg", "~> 1.1"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 4.0"

# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"

# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails"

# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails"

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"

# Use Redis adapter to run Action Cable in production
gem "redis", "~> 4.0"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false

gem 'wkhtmltopdf-binary', '~> 0.12.6.6'
gem 'wicked_pdf'

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
gem "image_processing", '>= 1.2'

group :development do
  gem "debug", platforms: %i[ mri mingw x64_mingw ]
  # Use console on exceptions pages [https://github.com/rails/web-console]
  gem "web-console"

  # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
  # gem "rack-mini-profiler"

  # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
  # gem "spring"
  gem 'rvm1-capistrano3', require: false
  gem 'capistrano-bundler', require: false
  gem "capistrano", "~> 3.10", require: false
  gem "capistrano-rails", "~> 1.6", require: false
end

group :test do
  # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
  gem "capybara"
  gem "selenium-webdriver"
end

Possible Solutions (if any):
I have tried different possible solutions found on Google but they did not work.

References:

Note:
This issue seems to be specific to the wkhtmltopdf-binary gem during the deployment process. I have checked for existing reports on the RubyGems GitHub repository, and no similar issues were found. I'm creating this issue to seek assistance in resolving the problem.

Uploading Screenshot 2023-11-17 at 11.56.36 PM.png…
Uploading Screenshot 2023-11-17 at 11.58.08 PM.png…

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions