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
Gallery block: image media API call throws 500 error #41825
Comments
@Mamaduka it seems like there might be some instances where the combined media api call in the Gallery is causing a 500 server error. The user reporting it says there isn't anything obvious in the debug log, and I can't replicate it locally. Do you have any thoughts on the best way to try and track down the cause of the server error with this API call? |
I've tried everything I can think of server side including: Additional directives for HTTP & HTTPS: Additional nginx directives: |
Thanks for the ping, @glendaviesnz. I will try to look into this today/tomorrow. |
I asked about this / forwarded the ticket to the hosting community team to see if anyone else has encountered the issue there.
|
I am the host, but with UKFast so I can ask for their assistance if need be. I don't believe any firewall would be affecting it. |
Do you have Nginx error log entries available from these 500 errors? |
Yes - latest few lines are
I don't remember there being nginx error when I first found this issue so not sure if they have occurred from adding 'Additional nginx directives' as above. |
Looks like the HTTP headers won't fit into the buffer. Try tweaking the large_client_header_buffers setting from Nginx which default it is "4 8k" enlarge it to "4 16k". |
Thank you - I have now done this but the image options are still buffering for one gallery block. This is what it is now set to |
Also on the one that I can now set the image options for hasn't fixed the problem that now over half the images aren't openable with lightbox on the front end. If you scroll to about half of the way down and hover some images you will see that the image does not have a link with fancy box class assigned. I believe this to be because the image option wasn't set correctly but it hasn't fixed the problem there. |
I'm getting apache error Premature end of script headers: index.php, referer: https://dev.lalachoirs.co.uk/wp-admin/post.php?post=62085&action=edit |
If I look at the pictures loading from both gallery url's, the load okay according to the network tab from the dev tools. I assume that the error from the Nginx log is not showing up now. With Plesk Nginx functions as a proxy in front of Apache httpd so it is possible that your problem moved from Nginx to httpd. Observe the error logs when interacting with the photo gallery. |
Looks to have reverted back to just apache errors. There are no errors from loading the front end.
|
Ok so we have managed to fix the 'loading options' issue by following the suggestions here Now we are back to having nginx errors - example:
And the problem of no link and therefore the lightbox not working on some of the images on front end. |
Are there any changes in Gutenberg required here? Can folks still replicate the issue? |
I experience the same issue with a gallery block of as fewer as 3 images. See here - https://japanball.com/articles-features/japanball-tours/guest-memoirs/2022-netherlands-tour-recap-and-photo-log/ A handful of galleries on the page that do not link images to media files have image size in the constantly loading state. |
Any update on the issue? Is anyone stiil working on it? |
Are you able to provide details about any error messages that show in the browser dev tools console, or network tab when you load the page in the editor and the image size select hangs on loading? |
@glendaviesnz, The console tab shows no errors and no relevant blocked resources on the network tab could be noticed. Can I do anything else? Is there a fix? |
Any update? |
Sorry about the delay on replying @bezbee. Are you able to add the following filter to the network tab |
Hey @glendaviesnz! When the page is opened in the editor: The network tab does not show any errors (statuses: 101, 200, 204, 206) Did I do correctly what you asked for? |
504 indicates that the server is timing out before the request is returned, so I don't think the problem is related to the Gallery block. @Mamaduka have you seen anything like the above 504 error on media retrieval before? It is unrelated to the 500 header length issue I think. |
I can't recall. I see that 504 happens even when Re: 500 errors I came across this issue #11541 last week, and there's an example of how core solved a similar issue for the script loader. So maybe we could try doing the same with the new P.S. I think we can close this and all 500 error-related issues as duplicates of #11541. |
Thanks @Mamaduka. @bezbee looking at those errors, I don't think this a Gutenberg related issue, as @Mamaduka notes there might be another plugin in your system that is causing timeouts when processing images. You could try disabling any image related plugins one at a time and see if that resolves the issue, if it does then contact the plugin authors of the one that seems to cause the issue. Closing this one now in favour of #11541 |
I am having this problem again with a new gallery block today. A difference though with this one is that none of the images are able to open in lightbox. The gallery has 160 photos in it. I've tried deactivating image related plugins and that doesn't help. |
I just tried to edit a gallery with over 100 images, and it broke the gallery. Now I'm here with the same problem. |
This is the error: per_page must be between 1 (inclusive) and 100 (inclusive) If I edit in FF dev tools, and change the per_page to 100, and resend, I get a 502 bad gateway. The gallery was working fine, until I tried to edit it today. The images load, and I can add and delete images, but none of the images will link to the media file anymore. |
Thanks for more details, @kbauman!
This error is fixed via #46143, and it's already available in Gutenberg plugin 14.7. I understand that not every project can install the plugin, so a small snippet below will increase the maximum supported /**
* Increase the default WP core maximum for the media endpoint.
*/
add_filter( 'rest_attachment_collection_params', function( $query_params ) {
$query_params['per_page']['maximum'] = 200;
return $query_params;
} ); |
Great! Thank you. That fixed it. |
Ok so that has fixed the 'loading options...' bug - thank you. |
Thanks for the feedback, @dynamek. The core doesn't ship with lightbox, so it's hard to debug a thing without knowing what you are using. Do you mind sharing the name of the plugin? |
I don't know if that is relevant as it is the whole link that isn't there. If there was no lightbox installed it should still have the link that would open the image but this is not there. The gallery is sent to Link to Media File, |
Hi - has anyone had a chance to get back to this one after the holidays? I'd be grateful for a solution. |
Description
As noted here there are some instances where the call by the Gallery block to the API to get image data for all gallery images results in a 500 error.
Since #34389 the request to get the image data was combined into a single request, so this might be related to a server resource issue as the issue report here relates to a gallery with over 100 images.
Step-by-step reproduction instructions
I was not able to replicate this issue on a local install, but @dynamek gets it consistently on their install, but only with a large gallery with over 100 images.
The text was updated successfully, but these errors were encountered: