Skip to content
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

Log error when media generation fails #6875

Open
andreasotto opened this issue Dec 19, 2024 · 1 comment
Open

Log error when media generation fails #6875

andreasotto opened this issue Dec 19, 2024 · 1 comment
Labels
needs: information ❓ Requires more information to proceed

Comments

@andreasotto
Copy link

Description

Failed generation of media image files, no log, no exception, no info (again, see previous discussions, closed as stale). The error handling still does not seem to be available at this point, because although no image could be created, the browser is redirected to a media URL that does not exist. This only leads to a 404 message from the web server. However, it would make sense in the code to go directly to an error handling routine at the point where no image could be created.

Where should I start looking for the error, since there is not a single information for me as a developer?

Expected behavior
As a developer, I expect an error message if images cannot be generated in the media folder so that I am able to solve the problem.
I also expect that if an error occurs, there is no redirect to a URL in the media folder, because there is no file there and it will inevitably lead to a 404 error. It would certainly be better to intercept the error and generate an error message for the operator. In addition, an error image could be displayed in the browser instead of an empty redirection to nowhere.
The error message could either be a log file with the error description on the server or a message in the HTTP response, which helps a developer to understand the error. At the moment I have no way of finding out. Do I have to start debugging the Kirby code installed via composer line by line with some print and echo statements? I hope there are other possibilities and am happy for hints.

Screenshots
d60b9186a73c17b02aa6ca20c6a78b0a694fb79a
588aebd8cc6a7da282ac0bca38694277beb3280c
eab6be671432330c789f2946d04db2b179e25afa

To reproduce

Upload an image, it gets already displayed broken in the panel, and thumb() function in frontend doesn't work also - broken images, because of redirect to not existing URL in media folder.

Your setup

Docker, php:8.3-apache
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp=/usr/include/

@distantnative distantnative changed the title Again, missing image files in media folder: How to debug? Missing image files in media folder: How to debug? Dec 19, 2024
@distantnative distantnative changed the title Missing image files in media folder: How to debug? Log error when media generation fails Jan 17, 2025
@distantnative
Copy link
Member

I've tried to turn your comment into an enhancement suggestion.

Not all what you write can directly be applied. For performance reasons, Kirby's media generation is async. The CMS only creates the media URLs (and .job files) during page rendering to not delay that process through the performance-heavy media generation as thumbs. At that point, no media files exist. No matter whether they will succeed or fail, the render process that outputs the HTML does not know what will happen in the future and, thus, cannot put out an error directly.

Only when the browser then tries to load the media file from the provided URL, Kirby tires to retrieve the file, or - if doesn't exist yet but with a .job file - then start the media generation, save the file and deliver it.

What HTTP response do you see when you open the media URL directly. Does anything gets returned? Any error then?

@distantnative distantnative added the needs: information ❓ Requires more information to proceed label Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: information ❓ Requires more information to proceed
Development

No branches or pull requests

2 participants