Closed mike-lloyd03 closed 5 months ago
I have the same pronlem
Thanks for the precise bug report. The error about contacts is fixed in v0.0.22. It would be nice if you could try it.
The only thing related to photos in your logs is [integration_google] Warning: Google API error getting album list, no "albums" key in []
. This means Google API is returning an empty array when asking for album list.
Could you try the "live API" there https://developers.google.com/photos/library/reference/rest/v1/albums/list?hl=en_US ? Just click "execute" in the right sidebar. I'm interested to see what's the response (appearing right under the "execute" button).
Thanks. The response I get is a json object with the following format:
{
"albums": [
{
"id": "<id>",
"title": "<title>",
"productUrl": "<productUrl>",
"mediaItemsCount": "<mediaItemsCount>",
"coverPhotoBaseUrl": "<coverPhotoBaseUrl>",
"coverPhotoMediaItemId": "<coverPhotoMediaItemId>"
}
],
"nextPageToken": "<token>"
}
Well apparently the response the integration_google app is receiving is something like []
or {}
:grin:. I don't know why...and there's not much I can do without further information. The only difference between the live API and the Nextcloud app is the "OAuth app" that is used. With the Nextcloud app, it's the one that you configured.
It's disturbing that the app can tell you the number of photos and then not get the album list because the same https://photoslibrary.googleapis.com/v1/albums
request is done in both cases.
What information can I give you to help?
Also interesting, it knows which albums are shared because checking/unchecking the 'Ignore Shared Albums' checkbox updates the photo count.
Okay I just checked my Google API console. Under 'OAuth Consent Screen', there's a warning saying:
We are currently experiencing service disruptions and are unable to provide quota information at this time.
That could be it.
What information can I give you to help?
I don't know :grin:.
It would help if you could add this:
if (preg_match('/v1\/albums$/i', $url)) {
file_put_contents('/tmp/test', $body);
}
between lines 113 and 114 (just before return json_decode($body, true);
) of lib/Service/GoogleAPIService.php
.
Then launch the photo import and when the [integration_google] Warning: Google API error getting album list, no "albums" key in []
warning appears in the logs, get the content of /tmp/test
file. It is the raw response of the API.
That could be it.
I doubt it as you can see get the photo number...you can get this album list when loading the migration settings page but not when importing. Weird stuff, really :grin:.
If you prefer, I can produce a nightly build of the app and you would only have to install it manually. Would you prefer that?
Let me give this a try real quick.
Now I'm getting this error banner five times when I load the page:
This application requires JavaScript for correct operation. Please enable JavaScript and reload the page.
Yeah there is a syntax error in the snippet. I fixed it. Sorry.
I should have caught that.
Okay the empty array error is still popping up in the log but nothing is being written to /tmp/test
For what it's worth, I get the same problem when trying to import files from Drive including the empty Album array error.
Damn, long day, replace $url
by $endPoint
in the snippet. It should now write something in /tmp/test
.
Thanks for your patience.
Same problem here
Photo import at noe working for my part. Files does still not work.
Okay still nothing is being written to /tmp/test
. This is what I have in 'GoogleAPIService.php`, lines 111-118:
if ($respCode >= 400) {
return ['error' => $this->l10n->t('Bad credentials')];
} else {
if (preg_match('/v1\/albums$/i', $endPoint)) {
file_put_contents('/tmp/test', $body);
}
return json_decode($body, true);
}
Am I missing something?
@mike-lloyd03 Is the file created? If it's created but stays empty it means the response you get from Google API is an empty string.
Let's try something else: Could you authorize this URL : https://localhost/dev/server/index.php/apps/integration_google/oauth-redirect
in developer console -> OAuth 2.0 Client IDs -> your web app -> Authorized redirect URIs ?
I would need the app's Client ID and secret (you can send them by email).
It will let me try to authenticate to my google account through your OAuth app. I will hopefully be able to reproduce the bug on my side and then...we'll see.
@eneiluj
Sorry it has taken me so long to get back to you. No file is being created at /tmp/test
.
I just sent you an email with the details you needed and I added the URL to my Google web app.
Thanks for your help with this.
@mike-lloyd03 Don't be sorry, you're helping a lot!
It's working for me with your OAuth app so let's find out what happens exactly. I wonder if it can be because you're using a reverse proxy like @Bergum. @BenjaminAlpert Are you using a reverse proxy too?
One thing is for sure, things are working fine when your Nextcloud does the requests as an authenticated user because you get the photo count in the settings page. The background job used to import photos/drive is launched in a different context. This might be the source of the problem.
I suspect the authentication is not correctly provided to the requests in the background job. Let's find out.
So I made a nightly release with a lot of level 1 logs. Could you install it (just replace the .../nextcloud/app/integration_google
directory) and change .../nextcloud/config/config.php
to set log level to 1:
'loglevel' => 1,
There will be much more information in your logs. I would need to see what happens there when you import your google photos. We're gonna nail this bug...hopefully.
Yes, I am using Nginx Reverse Proxy. I am also using cron for background jobs.
You have a new log file.
@BenjaminAlpert ok good to know, thanks.
@Bergum Thanks. I guess you were using latest release and not the nightly build. Anyway, fixed 2 more things thanks to your logs:
v0.0.24 is out.
Something interesting in @Bergum log file:
{"Exception":"Error","Message":"fread(): read of 8192 bytes failed with errno=9 Bad file descriptor at /var/www/nextcloud/3rdparty/icewind/streams/src/Wrapper.php#91...
So either:
If someone has time to setup a test instance without reverse proxy on the same machine and try importing photos and drive, it would be interesting to know if the issue we're facing is related to reverse proxies.
Thanks again to all of you for you perseverance.
I was using the latest nightly. Or, I think i was. I dowloaded i and extrackted
but, im a noob on ubuntu.
Edit: Nope. I failed. Extrackted to the wrong place. New log is coming... .
New logfile uploaded.
@Bergum There is nothing on 2020-11-18 related to drive or photo import in your logfile. What did you do before getting it? I need a full run of those import to see something in the log file. Thanks anyway :grin:
I should be able to just forward traffic to my Apache server directly and forego nginx. I'll try tonight.
I installed the nightly, set log level, stopped all of the imports that was running, started a new import of all possible imports, and watched until new lines stopped coming into the log app. Then i sendt you the log.
Looks like the problem is definitely with my nginx setup. I bypassed it and the transfer from google drive seemed to be working as expected.
@Bergum I think the upload failed. I don't see the file.
@mike-lloyd03 Some progress! I still can't see why the reverse proxy is problematic in the background job context and not when loading the page and getting photo/files number...
Hey everyone. I have a similar issue though since not having the same setup (no proxy and NC is located on a VPS) and no errors in logs as it seems. I'm not sure do i open a new issue or continue here, so waiting for feedback.
Sorry for the long delay. Have you had any success with Proxy yet? Have uploaded the latest log file.
I am also facing this issue of not being able to import files from Google Drive. For me the integration doesn't produce any log messages (errors or warnings), it just stays at 0% files imported.
Like @mike-lloyd03, I am also using Nginx. My setup is nearly identical to the Nginx configuration given in Nextcloud's documentation.
I am also facing this issue of not being able to import files from Google Drive. For me the integration doesn't produce any log messages (errors or warnings), it just stays at 0% files imported.
Like @mike-lloyd03, I am also using Nginx. My setup is nearly identical to the Nginx configuration given in Nextcloud's documentation.
Same problem here, at some point it made some folders but no files imported.
Same problem here, at some point it made some folders but no files imported.
That is the same with me, it created the folders, but does not dowload the files. Im behind a Proxy
I had this issue too and used Rclone in the end, create google drive and webdav links then copy from one to the other. If you want to migrate photos then you need to repeat the process specifically for the photos remote.
I'm having issues with this too and I think I may be running into the same symptoms. I have oauth set up and everything appears fine. In the user settings it gives the option to import calendars, Google Drive and Google Photos but when I try to import it just stays on 0 imported. I thought it might be because my "web app" isn't verified so I've attempted that process but it seems far too difficult for something so simple.
I'm also behind a reverse proxy but mine is haproxy.
Same problem here. At the first time about 100 photos had been imported from google photo, But that was it. never works again.
Same problem here as @OctopusET. But only 60 of 700+ photos imported NC 21.0.3
I managed to migrate Contacts, Calendars and Photos, but the Drive files are stuck on 0%. I'm using Nextcloud 20.0.12 installed with NextCloudPi. Running on Raspberry Pi 4 4GB with Raspberry Pi OS.
I have same issue, unable to import Google drive content. Only folder structure is copy, but no files.
Any way to solve this issue ?
I have the same issue. Contacts & calendars are imported fine, but google drive doesn't work. I can see some api calls inside cloud console too, but no files or folders are created.
I'm not sure if my nginx config is correct, therefore I'm posting it here so that you can have a look at it. I copied my nginx config from various places so maybe some configs are not nessesary. 😅
server {
server_name cloud.domain.tld;
add_header X-Served-By "Served by Me!";
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
client_max_body_size 5G;
# Enable gzip but do not remove ETag headers
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
# Remove X-Powered-By, which is an information leak
fastcgi_hide_header X-Powered-By;
rewrite ^/\.well-known/carddav https://$server_name/remote.php/dav/ redirect;
rewrite ^/\.well-known/caldav https://$server_name/remote.php/dav/ redirect;
location /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto https;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Content-Security-Policy upgrade-insecure-requests;
proxy_cache_bypass $http_upgrade;
proxy_pass http://172.1.1.2;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/cloud.domain.tld/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/cloud.domain.tld/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
server_name cloud.domain.tld;
listen 80;
return 301 https://$host$request_uri;
}
FWIW, I also get folders but no files with Google Drive, although Contacts & Calendar works perfectly. Unlike others, I'm using pfSense's HAProxy vs nginx proxy manager for my Reverse Proxy.
Like others, it shows the right number of files/photos to be synced as well as space required.
Is this ever gonna be fixed? I am facing the same problem running behind nginx proxy. I can't believe this has been an open issue for over a year and still no resolution.
Not sure if this alone fixed Photos import (Drive still is stuck at 0% & importing only folders but no files) - but I created a Service Account attached to my project. And now my Photos are slowly importing!
Not sure if this alone fixed Photos import (Drive still is stuck at 0% & importing only folders but no files) - but I created a Service Account attached to my project. And now my Photos are slowly importing!
What type of service account did you attach? I've still had no luck getting this to work with next cloud in this NGINX configuration.
Hello :wave: This issue appears to have had no activity for 3 months. We cannot keep track of whether individual issues have resolved themselves or still require attention without user interaction. We're thus adding the stale label to this issue to schedule it for getting closed in 5 days time. If you believe this issue is still valid and should be fixed, you can add a comment or remove the label to avoid it getting closed.
Cheers :blue_heart:
Still very interested in a fix for this!
Problem
I followed the instructions and have authenticated my Google account with the integration app. The app can see how many documents and photos I have but when I try to import, nothing happens. The Google API dashboard shows requests being made with
200
response codes but no data is transferred.Current Setup
Apache Configuration
nginx Configuration
Nextcloud Configuration
Nextcloud Logs