laravel-medialibrary: Release 10.7.14: 502 Bad Gateway

I receive a very strange 502 Bad Gateway that I cannot explain after upgrading to 10.7.14 when calling getFirstMediaUrl, but it seems to be a bit random when it appears. I don’t know how to provide more information as I cannot really isolate the issue - I could present it in a call if you are interested. It seems to happen in the very basic Arr::first method of Laravel. It happens across different systems.

For now I will stick to release 10.7.13. This issue is more of an information to others that have the same problem.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 7
  • Comments: 30 (9 by maintainers)

Most upvoted comments

I’ve just released 10.7.15 that reverts the changes of 10.7.14

In that previous version a potential N+1 probably was solved by explicitly setting a related model on a Media object. My hunch is that there’s something going wrong when Laravel / PHP tries to serialise such a media object when queuing stuff. In our tests we don’t queue stuff, and that might be the reason why our testsuite didn’t catch it.

My apologies for any inconvenience. Do let me know if 10.7.15 works for you.

All good here as well! In a world where problems and bugs are inevitable, a fast response and prompt turn around are highly valued ❤️

That 9.18 is missing ^ so it’s forcing the specific version.

I’ve just tagged 10.7.16 that fixes that problem. Anything between Laravel 9.18 and 10 is now allowed too.

@SebastianSchoeps Yes, it’s a Livewire app.

Works for me. Thanks very much for the very fast reaction!

Ok, even though the tests are indicating everything is ok, I’m going to revert the changes made in the last release.

Yep can confirm 10.7.16 is working for me too. Thank you for the quick turn around and help.

Updated to 10.7.16 and we’re good! Thanks @freekmurze

@steveallinson @Jam0r85 Do you guys have the error in a Livewire application?

Yes it’s in livewire but also happens with an attribute in my model(s) and plain blade files.

protected function getInvoiceAttribute()
{
 return $this->getFirstMedia('invoice');
}

Anytime I called the above Model and it had an uploaded file to that collection I received 502.

Nothing appears in my nginx log either. I just ran composer update and suddenly I was getting 502 errors anytime I tried to interact with a media URL eg. displaying an image. I’d share an error if I could find one but I only get the 502 error page and that’s it.

I can confirm with @HolgerHatGarKeineNode that it seemed to mess up my local installation.

I assumed it was an issue with my system but when I pushed the change to my live server the same thing happened there too.

Latest version of laravel, using valet, everything up to date, etc,.

@steveallinson @SebastianSchoeps @HolgerHatGarKeineNode would any of you guys want to try a local version of your app with this PR? https://github.com/spatie/laravel-medialibrary/pull/3226

@steveallinson @Jam0r85 Do you guys have the error in a Livewire application?

I’m not seeing the error, it would be very handy if any of you would share the actual error message + stack trace here.

Same for me and happens both locally and on my main server hosted by Hetzner.

Nothing else has changed, just simply an update and anytime I try to retrieve an URL it shuts the page down with a 502 error.

Downgrading to 10.7.13 works.

For me version 10.7.14 is not working. After upgrading today to latest version every request leads to 502 Bad Gateway. Locking composer.json to version 10.7.13 for now and investigating.