Description
Describe the bug
Face recognition fails to pull contact pictures with a 401 unauthorized response, shown in nextcloud logs. The failing URL in the log file correctly returns the contact image when visited from the browser.
At fist I thought this might be the fault of my reverse proxy (Traefik) so I changed the nextcloud configuration to 'overwrite.cli.url' => 'https://sub.domain.com/'
to http://localhost/
but still see the 401 response.
Interestingly, when file_get_contents() fails I see the exact same behavior as issue #137 when running php occ recognize:classify-images
from the cli. The 401 errors only appear in the nextcloud log, but the command output looks the same.
Stack trace from log:
{
"reqId": "geL7jQxgMIf9MgDiVELz",
"level": 3,
"time": "2022-01-10T06:29:01+00:00",
"remoteAddr": "",
"user": "--",
"app": "PHP",
"method": "",
"url": "--",
"message": "file_get_contents(http://sub.domain.com/remote.php/dav/addressbooks/users/jim/personal/B8E3244B-F48C-43AB-A80C-FCDA482FF497.vcf?photo): Failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized\r\n at /var/www/html/custom_apps/recognize/lib/Service/ReferenceFacesFinderService.php#72",
"userAgent": "--",
"version": "22.2.3.0",
"exception": {
"Exception": "Error",
"Message": "file_get_contents(http://sub.domain.com/remote.php/dav/addressbooks/users/jim/personal/B8E3244B-F48C-43AB-A80C-FCDA482FF497.vcf?photo): Failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized\r\n at /var/www/html/custom_apps/recognize/lib/Service/ReferenceFacesFinderService.php#72",
"Code": 0,
"Trace": [
{
"function": "onError",
"class": "OC\\Log\\ErrorHandler",
"type": "::",
"args": [
2,
"file_get_contents(http://sub.domain.com/remote.php/dav/addressbooks/users/jim/personal/B8E3244B-F48C-43AB-A80C-FCDA482FF497.vcf?photo): Failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized\r\n",
"/var/www/html/custom_apps/recognize/lib/Service/ReferenceFacesFinderService.php",
72
]
},
{
"file": "/var/www/html/custom_apps/recognize/lib/Service/ReferenceFacesFinderService.php",
"line": 72,
"function": "file_get_contents",
"args": [
"http://sub.domain.com/remote.php/dav/addressbooks/users/jim/personal/B8E3244B-F48C-43AB-A80C-FCDA482FF497.vcf?photo"
]
},
{
"file": "/var/www/html/custom_apps/recognize/lib/Service/ClassifyImagesService.php",
"line": 85,
"function": "findReferenceFacesForUser",
"class": "OCA\\Recognize\\Service\\ReferenceFacesFinderService",
"type": "->",
"args": [
"jim"
]
},
{
"file": "/var/www/html/custom_apps/recognize/lib/BackgroundJobs/ClassifyImagesJob.php",
"line": 64,
"function": "run",
"class": "OCA\\Recognize\\Service\\ClassifyImagesService",
"type": "->",
"args": [
"jim",
100
]
},
{
"file": "/var/www/html/lib/public/BackgroundJob/Job.php",
"line": 79,
"function": "run",
"class": "OCA\\Recognize\\BackgroundJobs\\ClassifyImagesJob",
"type": "->",
"args": [
null
]
},
{
"file": "/var/www/html/lib/public/BackgroundJob/TimedJob.php",
"line": 63,
"function": "execute",
"class": "OCP\\BackgroundJob\\Job",
"type": "->",
"args": [
{
"__class__": "OC\\BackgroundJob\\JobList"
},
{
"__class__": "OC\\Log"
}
]
},
{
"file": "/var/www/html/cron.php",
"line": 127,
"function": "execute",
"class": "OCP\\BackgroundJob\\TimedJob",
"type": "->",
"args": [
{
"__class__": "OC\\BackgroundJob\\JobList"
},
{
"__class__": "OC\\Log"
}
]
}
],
"File": "/var/www/html/lib/private/Log/ErrorHandler.php",
"Line": 92,
"CustomMessage": "--"
},
"id": "61dc621541d41"
}
To Reproduce
Steps to reproduce the behavior:
- Install recognize from Nextcloud Apps
- Enable face recognition
- Wait for cron or run cli (both fail)
Expected behavior
Contact faces correctly recognized without 401 errors in log.
Recognize (please complete the following information):
- JS-only mode: No
- Enabled modes: object detection, face recognition
Server (please complete the following information):
- Nextcloud: 22.2.3.0
- OS: Official Nextcloud docker container (Ubuntu host)
- RAM: 32GB
- Processor Architecture: x86
Additional context
Configuration 'allow_local_remote_servers' => true,
doesn't appear to make a difference.
Object recognition works as expected.