openfoodnetwork icon indicating copy to clipboard operation
openfoodnetwork copied to clipboard

chore(deps): bump wicked_pdf from 2.6.3 to 2.8.0

Open dependabot[bot] opened this issue 11 months ago • 5 comments

Bumps wicked_pdf from 2.6.3 to 2.8.0.

Changelog

Sourced from wicked_pdf's changelog.

[2.8.0]

New Features

Fixes

[2.7.0]

New Features

Fixes

Commits

Dependabot compatibility score

You can trigger a rebase of this PR by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Note Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

dependabot[bot] avatar Feb 28 '24 09:02 dependabot[bot]

Hey @mkllnk ,

Hum, indeed worth testing manually:

We seem to get an error 500 on bulk invoice print and when printing invoices individually (order edit page):

https://app.bugsnag.com/yaycode/openfoodnetwork-uk/errors/65e7303d74bd9c00081f7bbc?filters[error.status]=open&filters[event.since]=30d&filters[app.release_stage]=staging&event_id=65e7316f00dd930b19d00000

image

This needs some fixing before we can merge.

Moving to dev ready.

filipefurtad0 avatar Mar 05 '24 15:03 filipefurtad0

@filipefurtad0 I'm not able to reproduce the issue locally.

abdellani avatar Mar 14 '24 11:03 abdellani

Humm, I can still see this after staging... image

But I don't see any bugsnag error. I'll look into the server logs and post back.

filipefurtad0 avatar Mar 15 '24 15:03 filipefurtad0

Hey @abdellani ,

Here's the log from the error 500, I hope this helps:

I, [2024-03-15 15:31:08 #3607]  INFO -- : source=rack-timeout id=8472e8f7-7c43-4c05-a99f-e0e602598715 wait=5ms timeout=29995ms state=ready
I, [2024-03-15 15:31:08 #3607]  INFO -- : Started GET "/admin/orders/R115885050/print" for 176.79.242.165 at 2024-03-15 15:31:08 +0000
I, [2024-03-15 15:31:08 #3607]  INFO -- : Processing by Spree::Admin::OrdersController#print as HTML
I, [2024-03-15 15:31:08 #3607]  INFO -- :   Parameters: {"id"=>"R115885050"}
I, [2024-03-15 15:31:08 #3607]  INFO -- :   Rendered spree/admin/orders/invoice4.html.haml (Duration: 1.6ms | Allocations: 205)
I, [2024-03-15 15:31:08 #3607]  INFO -- : Completed 500 Internal Server Error in 369ms (ActiveRecord: 115.9ms | Allocations: 31778)
I, [2024-03-15 15:31:08 #3607]  INFO -- [Bugsnag]: Notifying https://notify.bugsnag.com of TypeError
F, [2024-03-15 15:31:08 #3607] FATAL -- :   
ActionView::Template::Error (no implicit conversion of nil into String):
    1: = pdf_stylesheet_pack_tag "mail"
    2: 
    3: %table{:width => "100%"}
    4:   %tbody
  
app/helpers/application_helper.rb:69:in `pdf_stylesheet_pack_tag'
app/views/spree/admin/orders/invoice4.html.haml:1
app/controllers/spree/admin/orders_controller.rb:112:in `print'
I, [2024-03-15 15:31:08 #3607]  INFO -- : Processing by ErrorsController#internal_server_error as HTML
I, [2024-03-15 15:31:08 #3607]  INFO -- :   Parameters: {"id"=>"R115885050"}
I, [2024-03-15 15:31:08 #3607]  INFO -- :   Rendered errors/internal_server_error.html.haml within layouts/errors (Duration: 1.4ms | Allocations: 95)
I, [2024-03-15 15:31:08 #3607]  INFO -- :   Rendered layout layouts/errors.html.haml (Duration: 2.5ms | Allocations: 158)
I, [2024-03-15 15:31:08 #3607]  INFO -- : Completed 500 Internal Server Error in 5ms (Views: 3.5ms | ActiveRecord: 0.0ms | Allocations: 387)
I, [2024-03-15 15:31:08 #3607]  INFO -- : source=rack-timeout id=8472e8f7-7c43-4c05-a99f-e0e602598715 wait=5ms timeout=29995ms service=585ms state=completed

filipefurtad0 avatar Mar 15 '24 15:03 filipefurtad0

Requires fix, see the dependency updates guide.

dacook avatar Apr 02 '24 00:04 dacook

Hello guys

I did have a look at this one and would appreciate some input

The server error we now get with version 2.8.0 is raised due to changes in how assets are loaded in wicked_pdf (change commit)

Before 2.8.0 there was a check (if Rails.application.assets_manifest.assets[path]) for compiled assets in pipeline which has been removed and now called directly in asset_path = File.join(Rails.application.assets_manifest.dir, Rails.application.assets_manifest.assets[path])

Also, Rails.application.assets_manifest.assets will target only assets compiled with sprockets and should return nil when we try to access the mail.css asset in our case (since its compiled via webpacker instead)

Just for asking purpose. Is the app/webpacker/packs/mail.scss properly loaded in the generated invoice pdfs in production at the moment?

wandji20 avatar Aug 01 '24 16:08 wandji20

Is the app/webpacker/packs/mail.scss properly loaded in the generated invoice pdfs in production at the moment?

I'm not sure how to tell. The difference between production and development is the pre-compilation of assets. So you could experiment locally by pre-compiling assets and see which results you get in invoices.

mkllnk avatar Aug 01 '24 22:08 mkllnk

I am positive the styles in mail.scss are not loaded in the generated invoice pdfs in production. Connected to.

Also, Rails.application.assets_manifest.assets will target only assets compiled with sprockets and should return nil when we try to access the mail.css asset in our case (since its compiled via webpacker instead)

The best solution I believe would be to make a fix on wicked_pdf end.

Posiible Solution

  1. Move mail related styles to app/assets/stylesheets/mail.scss. And precompile this file and make it available via asset pipeline.
  2. Completely remove these wicked_pdf_stylesheet_pack_tag from the pdf templates since they were never used anyways. Note// There is a comment in code about styles not being loaded (app/views/layouts/pdf.html.haml)

    -# Using wicked_pdf_stylesheet_pack_tag with a new pdf pack was not working when using -# WickedPdf.new.pdf_from_string cause the css file reference was not absolute -# So I ended up putting inline css here, so it's included for sure in the PDF

wandji20 avatar Aug 02 '24 20:08 wandji20

I would say go ahead with removing the tag and we try it out.

mkllnk avatar Aug 06 '24 00:08 mkllnk

OK, I won't notify you again about this release, but will get in touch when a new version is available. If you'd rather skip all updates until the next major or minor version, let me know by commenting @dependabot ignore this major version or @dependabot ignore this minor version. You can also ignore all major, minor, or patch releases for a dependency by adding an ignore condition with the desired update_types to your config file.

If you change your mind, just re-open this PR and I'll resolve any conflicts on it.

dependabot[bot] avatar Aug 22 '24 15:08 dependabot[bot]