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

Server error or APl not found. api Import::server is server_error #1237

Closed
jhrcc opened this issue Mar 3, 2022 · 17 comments
Closed

Server error or APl not found. api Import::server is server_error #1237

jhrcc opened this issue Mar 3, 2022 · 17 comments

Comments

@jhrcc
Copy link

jhrcc commented Mar 3, 2022

image

production.ERROR
[2022-03-03 02:50:12] production.ERROR: array_merge(): Argument #1 must be of type array, string given {"exception":"[object] (TypeError(code: 0): array_merge(): Argument #1 must be of type array, string given at /var/www/html/Lychee/vendor/lychee-org/php-exif/lib/PHPExif/Mapper/Exiftool.php:355)
[stacktrace]
#0 /var/www/html/Lychee/vendor/lychee-org/php-exif/lib/PHPExif/Mapper/Exiftool.php(355): array_merge()
#1 /var/www/html/Lychee/vendor/lychee-org/php-exif/lib/PHPExif/Adapter/Exiftool.php(163): PHPExif\Mapper\Exiftool->mapRawData()
#2 /var/www/html/Lychee/vendor/lychee-org/php-exif/lib/PHPExif/Reader/Reader.php(108): PHPExif\Adapter\Exiftool->getExifFromFile()
#3 /var/www/html/Lychee/app/Metadata/Extractor.php(153): PHPExif\Reader\Reader->read()
#4 /var/www/html/Lychee/app/Actions/Photo/Create.php(127): App\Metadata\Extractor->extract()
#5 /var/www/html/Lychee/app/Actions/Photo/Create.php(71): App\Actions\Photo\Create->loadFileMetadata()
#6 /var/www/html/Lychee/app/Actions/Import/Exec.php(275): App\Actions\Photo\Create->add()
#7 /var/www/html/Lychee/app/Actions/Import/FromServer.php(73): App\Actions\Import\Exec->do()
#8 /var/www/html/Lychee/vendor/symfony/http-foundation/StreamedResponse.php(109): App\Actions\Import\FromServer->App\Actions\Import\{closure}()
#9 /var/www/html/Lychee/vendor/symfony/http-foundation/Response.php(394): Symfony\Component\HttpFoundation\StreamedResponse->sendContent()
#10 /var/www/html/Lychee/vendor/laravel/framework/src/Illuminate/Support/HigherOrderTapProxy.php(34): Symfony\Component\HttpFoundation\Response->send()
#11 /var/www/html/Lychee/public/index.php(75): Illuminate\Support\HigherOrderTapProxy->__call()
#12 {main}
"}

System Information
--------------
Lychee Version (git):            No git data found.
DB Version:                      4.5.0

composer install:                --no-dev
APP_ENV:                         production
APP_DEBUG:                       false

System:                          Linux
PHP Version:                     8.1
PHP User agent:                  Lychee/4 (https://lycheeorg.github.io/)
Timezone:                        UTC
Max uploaded file size:          100M
Max post size:                   100M
Max execution time:              3600
MySQL Version:                   10.3.32-MariaDB

Imagick:                         1
Imagick Active:                  1
Imagick Version:                 1691
GD Version:                      2.3.0
@kamil4
Copy link
Contributor

kamil4 commented Mar 3, 2022

This fails for a particular picture being imported, doesn't it? Could you share with us that picture so that we can reproduce the problem on our end?

@jhrcc
Copy link
Author

jhrcc commented Mar 3, 2022

I didn't locate the specific one, I did it through Import from Server
path, after the error message, many paths can not be imported, but the single upload method can be uploaded
Here are the names of my files
image

Multiple repeat imports will randomly import one or more sheets

@nagmat84
Copy link
Collaborator

nagmat84 commented Mar 3, 2022

As @kamil4 said it seems to be a specific failf (or a specific category of files) which is failing. These files have probably exhibited certain characteristics which the EXIF tool is not capable of handling (e.g. a particular EXIF attribute, etc.) . So without the specific file it will be difficult to solve this problem. The list of file names is not really helpful.

However, if you are very brave and if you have the possibility, you could try to switch to the branch "consistent_json_api". The main achievement of this branch is a consistent and much more accurate error reporting. Maybe this branch would provide you and us with an error message which helps to solve this problem.

@jhrcc
Copy link
Author

jhrcc commented Mar 3, 2022

As @kamil4 said it seems to be a specific failf (or a specific category of files) which is failing. These files have probably exhibited certain characteristics which the EXIF tool is not capable of handling (e.g. a particular EXIF attribute, etc.) . So without the specific file it will be difficult to solve this problem. The list of file names is not really helpful.

However, if you are very brave and if you have the possibility, you could try to switch to the branch "consistent_json_api". The main achievement of this branch is a consistent and much more accurate error reporting. Maybe this branch would provide you and us with an error message which helps to solve this problem.

Okay, I'll try it.

@jhrcc jhrcc closed this as completed Mar 3, 2022
@jhrcc jhrcc reopened this Mar 3, 2022
@kamil4
Copy link
Contributor

kamil4 commented Mar 3, 2022

It's failing here: https://github.com/LycheeOrg/php-exif/blob/2f74ba7d7a66bc8c9af4e8e8731797d9d4103437/lib/PHPExif/Mapper/Exiftool.php#L355 so it must be getting triggered by IPTC:Keywords or XMP-dc:Subject (probably both present at the same time, actually). That's where tags are stored, I believe?

@kamil4
Copy link
Contributor

kamil4 commented Mar 3, 2022

@jhrcc Just to make sure that I understand, did you try uploading the same set of photos using Upload Photos functionality? I would expect it should fail also, but it should make it much easier to figure out which file(s) it's failing on...

@jhrcc
Copy link
Author

jhrcc commented Mar 4, 2022

Okay, I'll try it

@jhrcc Just to make sure that I understand, did you try uploading the same set of photos using Upload Photos functionality? I would expect it should fail also, but it should make it much easier to figure out which file(s) it's failing on...

@jhrcc
Copy link
Author

jhrcc commented Mar 4, 2022

@jhrcc Just to make sure that I understand, did you try uploading the same set of photos using Upload Photos functionality? I would expect it should fail also, but it should make it much easier to figure out which file(s) it's failing on...

Thank you, after I imported the photos once by importing them, all the rest can be imported normally, so I closed this issue

@jhrcc jhrcc closed this as completed Mar 4, 2022
@z-jun
Copy link

z-jun commented Mar 12, 2022

I just hit same problem while importing photo with single keyword in both tags. Solution is to "homegenize" $value of tags.

--- ./vendor/lychee-org/php-exif/lib/PHPExif/Mapper/Exiftool.php.old    2022-03-12 23:33:35.454873706 +0100
+++ ./vendor/lychee-org/php-exif/lib/PHPExif/Mapper/Exiftool.php        2022-03-12 23:32:41.507807585 +0100
@@ -349,10 +349,11 @@
                 // Merge sources of keywords
                 case self::KEYWORDS:
                 case self::SUBJECT:
+                    $xval = is_array( $value) ? $value : array( 0 => $value);
                     if (empty($mappedData[Exif::KEYWORDS])) {
-                        $mappedData[Exif::KEYWORDS] = $value;
+                        $mappedData[Exif::KEYWORDS] = $xval;
                     } else {
-                        $tmp = array_values(array_unique(array_merge($mappedData[Exif::KEYWORDS], $value)));
+                        $tmp = array_values(array_unique(array_merge($mappedData[Exif::KEYWORDS], $xval)));
                         $mappedData[Exif::KEYWORDS] = $tmp;
                     }

@gareththered
Copy link

For anyone, like me, who also hit this problem, a quick workaround is to remove the XMP-dc:Subject tag from all images before importing. I used:

find . -type f -exec exiv2 -M "del Xmp.dc.subject" \{\} \;

@adrfantini
Copy link

For anyone, like me, who also hit this problem, a quick workaround is to remove the XMP-dc:Subject tag from all images before importing. I used:

find . -type f -exec exiv2 -M "del Xmp.dc.subject" \{\} \;

This also fixed it for me... if this can be called a fix at least.

@nagmat84
Copy link
Collaborator

Please check whether you still have problems uploading your photos with the recent version of Lychee. This mystic error message Server error or APl not found is gone for quite a while. The backend had thrown this message for any kind of error. This indicates that you are using an outdated version of Lychee. Since then, there has also been some bug fixes to the EXIF data extractor.

If the bug still exists on a up-to-date version of Lychee, please file a new issue with the updated (and proper) error message. We would also be interested into the failing sample photo.

@adrfantini
Copy link

Please check whether you still have problems uploading your photos with the recent version of Lychee. This mystic error message Server error or APl not found is gone for quite a while. The backend had thrown this message for any kind of error. This indicates that you are using an outdated version of Lychee. Since then, there has also been some bug fixes to the EXIF data extractor.

If the bug still exists on a up-to-date version of Lychee, please file a new issue with the updated (and proper) error message. We would also be interested into the failing sample photo.

I'm using the latest LSIO docker, which I installed last week. Should be version 4.4.0. Is that too old?

@kamil4
Copy link
Contributor

kamil4 commented Aug 28, 2022

Yeah, 4.4.0 is too old. This bug was fixed in 4.5.3. Note that our official docker image is at https://hub.docker.com/r/lycheeorg/lychee

@adrfantini
Copy link

Yeah, 4.4.0 is too old. This bug was fixed in 4.5.3. Note that our official docker image is at https://hub.docker.com/r/lycheeorg/lychee

Thank you for the clarification!
I guess this could be closed then?

@qwerty287
Copy link
Contributor

It was closed already :)

@adrfantini
Copy link

It was closed already :)

😄
sorry, long days. Keep up the good work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants