matiasdelellis / facerecognition

Nextcloud app that implement a basic facial recognition system.
GNU Affero General Public License v3.0
500 stars 45 forks source link

Imaginary service? #700

Closed j3ffery17 closed 2 months ago

j3ffery17 commented 9 months ago

Hey, Thanks for reporting issues back to Nextcloud Face Recognition. Please, try to complete this report in detail so we can help you easier. :smile:

Make sure you read all the documentation, and the FAQ, and that the issue has not been reported before. :wink:

Expected behaviour

Trying to run initial background job

 sudo -u www-data ./occ face:background_job -u user

Actual behaviors

Getting the following:

1/8 - Executing task CheckRequirementsTask (Check all requirements) An Imaginary service (http://127.0.0.1:8080) was configured to manage temporary images, but it is inaccessible.Check out the service, or set the 'preview_imaginary_url' key appropriately.

Steps to reproduce

1. 2. 3.

Server configuration

Client configuration

Logs

Background task log with debug.

sudo -u apache php occ -vvv face:background_job ``` Insert your background log here ```

Web server error log

Web server error log ``` Insert your webserver log here ```

Nextcloud log (data/nextcloud.log)

Nextcloud log ``` Insert your Nextcloud log here ```

Browser log

Browser log ``` Insert your browser log here, this could for example include: a) The javascript console log b) The network log c) ... ```
alsoszaa commented 9 months ago

I think I had this issue as well because I was running a local instance of Nextcloud. Go to /var/www/NextCloud directory and edit the config.php file to allow local instances

'allow_local_remote_servers' => true,

j3ffery17 commented 9 months ago

Thanks. Tried that and still saw the error so I commented out rhe 'preview_imaginary_url' => http://127.0.0.1:8080 in config.php and then it worked.

GuillaumePod commented 5 months ago

I have the same problem, preview_generator works perfectly with an imaginary service but if I run php occ face:background_job -t 900 I have the same message.

1/8 - Executing task CheckRequirementsTask (Check all requirements)
       An Imaginary service (http://nextcloud-imaginary:9000) was configured to manage temporary images, but it is inaccessible.Check out the service, or set the 'preview_imaginary_url' key appropriately.
Task CheckRequirementsTask signalled we should not continue, bailing out
aseering commented 3 months ago

I'm running into the same issue. 'allow_local_remote_servers' => true doesn't help me, unfortunately.

I'm setting preview_imaginary_key in my config.php, and the key is required to access the Imaginary server. Does Face Recognition support API keys?

Dams07 commented 2 months ago

I'm running into the same issue :

1/8 - Executing task CheckRequirementsTask (Check all requirements)
        An Imaginary service (http://nextcloud-aio-imaginary:9000) was configured to manage temporary images, but it is inaccessible.Check out the service, or set the 'preview_imaginary_url' key appropriately.
Task CheckRequirementsTask signalled we should not continue, bailing out

If i run docker logs -f nextcloud-aio-imaginary i see 172.18.0.10 - - [23/Apr/2024 10:02:23] "GET / HTTP/1.1" 401 53 0.0002 -> HTTP 401 : so i think Face Recognition does not support API Keys ?

Thank you for your help.

fabalexsie commented 2 months ago

Looks like face recognition does not use the api key

https://github.com/matiasdelellis/facerecognition/blob/d5478c5035844b092ea403adcda14b6a059268c3/lib/Helper/Imaginary.php#L70

This call is used to check the accessability of the imaginary service, but it is missing the key.

According to the imaginary documentation the key can be passed as query parameter h2non/imaginary: Authorization

So in this example line it could be fixed with:

$response = $httpClient->get($imaginaryUrl . '/?key=' . $imaginaryKey); 

And similar for the other requests in the ImaginaryHelper file.

fabalexsie commented 2 months ago

I've created a small pull request which should fix the issue with not used api keys.

And to improve on the last comment, the httpClient has a better way of adding query parameters (which is also used in the PR):

$response = $httpClient->get($imaginaryUrl . '/', [ 'query': [ 'key' => $key ] ]);