Some documents upload with 500 Server Error

Hello,

I don’t think this is an application issue but hoping for some help. Some pictures taken from an iphone will upload with a 500 server error. This error happens if the jpg is uploaded via a PC or the iphone app. Not all photos will give this error however. It happens regardless of the size of the photo.

I am not able to find any actual detailed error logs in the ngnix logs. Only in the access log do i see a 500 error.

Chrome returns:

  1. {message: “Server Error”}

  2. message: “Server Error”

https://…/log_error?error=Uncaught%20TypeError%3A%20Cannot%20read%20property%20%27public_id%27%20of%20undefined&url=https%3A%2F%2FHIDDEN2Fexpenses%2F128%2Fedit

System is running PHP 7.2.34 and everything else is running just fine.

Is there a way to enable more logging to help diagnose the issue here?

Thanks!

Hi,

Are there any related errors in storage/logs/laravel-error.log

Thanks for the reply. The laravel logs show the following:

[2020-12-25 19:28:09] production.ERROR: ErrorException [0] : /var/www/ninja/app/Ninja/Repositories/DocumentRepository.php [Line 112] => getimagesize(): Read error! {“context”:“PHP”,“user_id”:1,“account_id”:1,“user_name”:“HIDDEN”,“method”:“POST”,“user_agent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36”,“locale”:“en”,“ip”:“HIDDEN”,“count”:1,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”,“url”:“documents”} []
[2020-12-25 19:28:09] production.ERROR: Uncaught TypeError: Cannot read property ‘public_id’ of undefined {“context”:“JavaScript”,“user_id”:1,“account_id”:1,“user_name”:“HIDDEN”,“method”:“GET”,“user_agent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36”,“locale”:“en”,“ip”:“HIDDEN”,“count”:2,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”,“url”:“log_error”} []

I’ve done a little research and appears to be the same behavior at here

In my case the PHP upload size is set to 20MB but I’ve also tested various qualities of the iphone photo and it will not work regardless. What is odd, is that some iphotos will work just fine with no issues

Here is a demo picture for an expense that will not upload. I’m curious, does it work for anyone else?

IMG_0080 - Copy|666x500

Also want to add, Im running 4.5.21

RESOLUTION

So it actually turned out to be a file size issue although I can’t explain why some phone photos upload and some don’t.

I verified the running config was the correct php.ini file that was correctly modified with the file upload and the max file upload size set to 20M.

Modified the nginx conf file to include

client_max_body_size 20M;

These did not resolve the issue. The final resolution here was to add the following line in the nginx conf file to the location ~php$ {} block

fastcgi_param PHP_VALUE “upload_max_filesize=20M \n post_max_size=20M”;

Works wonderfully now.

Thanks!

1 Like