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

ActionView::Template::Error uninitialized constant WickedPdf::WickedPdfHelper::Assets::SprocketsEnvironment::Sprockets #1102

Open
DanTaiko opened this issue Feb 6, 2024 · 5 comments

Comments

@DanTaiko
Copy link

DanTaiko commented Feb 6, 2024

The v2.7.0 of wicked_pdf seems not to be fully incompatible with Rails 7.
Rails 7.0 makes Sprockets an optional dependency. We don't use Sprockets in our Rails 7.1 app and updating wicked_pdf to v2.7.0 make us a bit of trouble.

There is a addition to WickedPdf::WickedPdfHelper::Assets#read_asset that makes the difference:
asset = find_asset(source)

Downgrading wicked_pdf back to v2.6.3 restored the functionality.

@dmrwebdev
Copy link

Our Rails 7.1 application just experienced the same constant error when dependabot updated our application to v2.8.0 from v.2.7.0. We are not using sprockets either.

fblupi added a commit to AjuntamentdeBarcelona/decidim-barcelona that referenced this issue Mar 21, 2024
@fblupi
Copy link

fblupi commented Mar 21, 2024

Same problem in an application with Rails 6.1.7.7 deployed in Heroku. Downgrading from v2.8.0 to v2.7.0 made the trick.

@blocknotes
Copy link

Same error in one of our projects while upgrading to the version 2.8.0

Perhaps it could be related to: #1117

@laurajaime
Copy link

Same problem with 2.8.0 here!

@attenzione
Copy link

attenzione commented Sep 17, 2024

I had CSS and image references in a PDF, and I resolved the issue by embedding them as base64:

= stylesheet_link_tag(asset_base64_for('pdf.css'))
= image_tag(asset_base64_for('invoices/logo.png'))

asset_base64_for depends on your implementation of serving assets. Simplified code is below:

def asset_base64_for(name)
  content_type = MIME::Types.type_for(name).first.content_type

  path = asset_physical_path(name) # this method returns location of the file
  return unless File.exist?(path)

  content = File.binread(path)
  base64 = Base64.strict_encode64(content)

  "data:#{content_type};base64,#{Rack::Utils.escape(base64)}"
end

fblupi added a commit to AjuntamentdeBarcelona/decidim-barcelona that referenced this issue Sep 24, 2024
* Upgrade to 0.28.0 disabling modules and customizations

* Enable instance modules and fix overrides from ephemeral module

* Fix CI pipelines and lint

* Add Procfile support

* Include ephemeral participation specs in the CI and fix them

* Install decidim-term_customizer

* Include census sms specs in the CI and fix them

* Include valid auth specs in the CI

* Include stats specs in the CI and fix all of them but one

* Lint

* Fix followers spec

* Split test modules in a different CI workflow

* Change array assertion methods

* Update dockerization

* Remove unused scripts

* Remove initiative header steps customization
It's not needed at all as it was changing the date separator from a dash to an arrow and the redesign uses an arrow

* Remove widget layout customization
It has been removed in the redesign

* Remove unused partial

* Rename monkey-patched views from decidim as they are pending to be reviewed

* Change workflow names

* Adapt accountability pages to redesign

* Reorder routes

* Remove decidim-dataviz from Gemfile

* Add 'rexml' gem for production

* Add 'matrix' gem for production

* Add yarn to engines

* Do not include polyfill for punycode

* Add Procfile

* Fix system specs

* Comment overrides to be reviewed

* Update user_profile_cell_override

* Add route-line icon

* Update activities override

* Lint

* Update proposal presenter override

* Update questionnaire user answers override

* Update join meeting button cell override

* Update zero duration meeting agenda items override

* Update BCN meeting iframe height override

* Update initiatives admin permission override

* Update permission to view not published meetings for space admins override

* Update custom initiatives supports required for specific ones override

* Update search resource fields mapper override

* Remove initiative card override to hide support button
The support button is not present in the redesigned cards

* Update accountability customization overrides

* Update join meeting button override

* Update form questionnaire answer index override

* Update initiative fill personal data override

* Exclude file from codeclimate

* Run workflow from module only on change

* Make modules compatible only to instance decidim version

* Update email override

* Remove project list item overrides
The cell has been replaced in 0.28.0 and now it shows the project budget amount in mobile by default so the override functionality is not needed anymore

* Update import results views

* Remove app.json as it's no longer needed

* Update and install decidim-dataviz

* Fix status cell error
'undefined local variable or method current_scope for Decidim::Accountability::StatusCell'

* Cleanup gems

* Cleanup styles

* Remove carrierwave initializer

* Downgrade wicked_pdf
See: mileszs/wicked_pdf#1102

* Install decidim-kids module

* Install decidim-decidim_awesome module (beta)

* Install decidim-navigation_maps module (beta)

* Add extra argument to SMS gateway

* Show 20 assemblies per page

* Lint

* Fix tests

* Use main branch of decidim-navigation_maps module

* Bump decidim from 0.28.0 to 0.28.1

* Remove workflow for decidim ephemeral participation module

* Run all workflows always

* Fix append stylesheet

* Skip tests failing because of Capybara driver

* Bump decidim from 0.28.1 to 0.28.2

* Specify zeitwerk autoloader

* Bump decidim-decidim_awesome version

* Add .node-version

* Bump decidim-decidim_awesome version

* Bump decidim from 0.28.2 to 0.28.3

* Fix overrides spec and lint erb files

* Update overrides_spec.rb

* Force cell cache expiration time

* Decrease cache expiry time to match the one provided by AWS

* Avoid segmentation fault from PostgreSQL on MacOS

* Script to populate hero images from scoped resources banner images

* Rescue error in content block hero image migration script
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

6 participants