sul-dlss / exhibits

Stanford University Libraries online exhibits showcase
https://exhibits.stanford.edu
Other
19 stars 7 forks source link

[exhibits/prod] Riiif::ImageNotFoundError: unable to find file for 1238 #688

Open mejackreed opened 6 years ago

mejackreed commented 6 years ago

Backtrace

View full backtrace and more info at honeybadger.io

jkeck commented 6 years ago

The remediation required to accomplish #768 did not end up addressing this issue (although I think they're both symptoms of the upload issues we were getting pre-IIIF).

I believe we could clean these up by finding all of the Spotlight::FeaturedImage classes whose mounted image's file is nil (unfortunately not a good way to query so we would have to iterate over all 2,558 featured image objects) and remove it as well as either the Exhibit, Page, or Browse Category that it was the associated thumbnail or masthead for.

This totally untested code might be around what we would want:

Spotlight::FeaturedImage.find_each |fi|
  # TODO: need to account for when there is no file but a IIIF tilesource/region is set.
  next if fi.image && fi.image.file # only continue if there is NOT a file

  if Spotlight::Exhibit.exists?(thumbnail_id: fi.id)
    Spotlight::Exhibit.where(thumbnail_id: fi.id).destroy_all
  elsif Spotlight::Exhibit.exists?(masthead_id: fi.id)
    Spotlight::Exhibit.where(masthead_id: fi.id).destroy_all
  elsif Spotlight::Page.exists?(thumbnail_id: fi.id)
    Spotlight::Page.where(thumbnail_id: fi.id).destroy_all
  elsif Spotlight::Search.exists?(thumbnail_id: fi.id)
    Spotlight::Search.where(thumbnail_id: fi.id).destroy_all
  elsif Spotlight::Search.exists?(masthead_id: fi.id)
    Spotlight::Search.where(masthead_id: fi.id).destroy_all
  end
end
corylown commented 2 months ago

This may still be a problem, see more recent honeybadger alerts:

https://app.honeybadger.io/projects/49092/faults/104685469 https://app.honeybadger.io/projects/49092/faults/106776014