# Lightbox not working for some locally stored images

**URL:** <https://meta.discourse.org/t/lightbox-not-working-for-some-locally-stored-images/100116>\
**Category:** Product Support\
**Created:** [October 22, 2018, 1:11am UTC](https://meta.discourse.org/t/lightbox-not-working-for-some-locally-stored-images/100116 "2018-10-22T01:11:27Z")\
**Posts on this page:** 5\
**Page:** 1

## AI-generated summary

[AdamAndrews](/t/-/100116/1) is experiencing issues with lightboxing locally stored images after setting up a Digital Ocean spaces bucket and configuring the S3 CDN. Some locally stored images fail to lightbox, causing errors in the Sidekiq retries queue. [sam](/t/-/100116/2) suggests running a rake task to migrate uploads to S3. However, [AdamAndrews](/t/-/100116/3) clarifies that the issue persists even after rebaking posts, with some locally stored images lightboxing properly and others not. [AdamAndrews](/t/-/100116/4) ultimately resolves the issue by migrating all images to the spaces bucket, concluding that a mix of local and remote images prevents the lightbox from working properly.

<div class="post-metadata">

**Author:** ![AdamAndrews](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@AdamAndrews](https://meta.discourse.org/u/AdamAndrews)\
**Post date:** [October 22, 2018, 1:11am UTC](https://meta.discourse.org/t/lightbox-not-working-for-some-locally-stored-images/100116/1 "2018-10-22T01:11:27Z")

</div>

I recently setup a spaces bucket on Digital Ocean. Currently I have a mix of locally stored images on a DO droplet along with that spaces bucket. After initially not configuring the S3 CDN for spaces, I went back and did that and rebaked all posts so the images would have CDN links. Since then it looks like a portion of the locally stored images are not getting lightboxed, everything on spaces seems fine. In Sidekiq the posts associated with these local images pile up in the retries queue and cycle through with the following error below. Clearing out the queue then choosing the rebuild html option in the admin tools for the post reproduces the same problem. The puzzling thing is it only effecting some posts, typically those with multiple images within one post. Have all the latest updates and have done the use update/rebuild to ensure latest code. Thanks in advance for any pointers as to how this might be fixed.

`Arguments: {"post_id"=>952, "bypass_bump"=>true, "cooking_options"=>nil, `

`Error: "current_site_id"=>"default"} Jobs::HandledExceptionWrapper: Wrapped NoMethodError: undefined method 'id' for nil:NilClass`

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [October 22, 2018, 4:35am UTC](https://meta.discourse.org/t/lightbox-not-working-for-some-locally-stored-images/100116/2 "2018-10-22T04:35:45Z")

</div>

There is no automatic migration when you switch settings.

You have to run a rake task.

```plaintext
./launcher enter app
rake uploads:migrate_to_s3
rake posts:rebake

```

---

<div class="post-metadata">

**Author:** ![AdamAndrews](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@AdamAndrews](https://meta.discourse.org/u/AdamAndrews)\
**Post date:** [October 22, 2018, 7:21am UTC](https://meta.discourse.org/t/lightbox-not-working-for-some-locally-stored-images/100116/3 "2018-10-22T07:21:27Z")

</div>

Hi Sam, thanks for the follow up. To clarify I have a mix of locally stored images being used in existing posts that predated setting up a spaces bucket for image uploads, along with newer posts post image upload settings change containing images uploaded to a spaces bucket.

Any posts containing images stored in the spaces bucket are being lightboxed properly, anything that is still stored locally for posts that predated setting up the spaces bucket for uploads are a mix, some are being lightboxed properly and others are not. Is the expected behavior that images should lightbox properly regardless of where they are stored or should those be migrated migrated to ensure all images will lightbox properly?

---

<div class="post-metadata">

**Author:** ![AdamAndrews](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@AdamAndrews](https://meta.discourse.org/u/AdamAndrews)\
**Post date:** [October 31, 2018, 1:34am UTC](https://meta.discourse.org/t/lightbox-not-working-for-some-locally-stored-images/100116/4 "2018-10-31T01:34:20Z")

</div>

Just as a followup for future reference, migrating all images to spaces bucket fixed the problem and everything is now lightboxed after a long rebake. If you want the lightbox to work properly you can’t have a mix of local and remote.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [November 30, 2018, 1:34am UTC](https://meta.discourse.org/t/lightbox-not-working-for-some-locally-stored-images/100116/5 "2018-11-30T01:34:22Z")

</div>

Closed on November 30, 2018, 1:34am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
