500 error when trying to add via service account

Failed to configure team drive: list team drives failed: googleapi: Error 500: Internal Error, internalError

I get this error when I attempt to create a remote with a service account file. Any ideas? (Yes, i have drive api enabled)

I also have Domain wide delegation enabled.

So that is google returning an error when rclone tries to list the teamdrives to present a menu of them.

Hmm, do you know the ID of the team drive?

Try saying no to use team drives and then edit the config file afterwards to say team_drive = XXX.

@ncw I’m seeing the same thing. However, your suggestion to manually add the team_drive line to the config file worked for me. Thank you!

Great! I wish I knew why google gives the 500 errors though! Is is something to do with your config?

I don’t think it is. I followed the config steps exactly in the docs for the service account. I’m only getting the 500 error when I use the service account. If I use a regular user account, I don’t get the 500 errors and it lists that user’s Team Drives properly.

So do you need to give the service account permissions to list the team drives?

Or maybe you need to use --drive-impersonate at that point?

I am having the same issue, where would we add the permission and which one would we need to add?

I tried to add it to the rclone config as well, but still no luck on getting access to the Team Drive. Thanks!

As a note, I am using a service account as well, and I can access the personal My Drive when I do impersonate command.

Actually, I just figured this out. I had to give specific access to the service account for the team drive. I followed this and everything worked out.

1 Like

However, your suggestion to manually add the team_drive line to the config file worked for me. Thank you!

I am having the same problem with the configure wizard not able to list Team Drive but still am seeing the following after saying no in the wizard and then manually adding the team_drive = in the confiig file afterwards:

./rclone -v lsd <Name of remote>:<Directory name>
2019/02/17 09:46:43 ERROR : : error listing: directory not found
2019/02/17 09:46:43 Failed to lsd: directory not found

Just to recap here is what I did:

  1. Set up service account under IAM
    I tried ticking on / off the “Enable G Suite Domain-wide Delegation” but that doesn’t do anything.

  2. Grant API Access under G Suite Admin

  3. Use rclone config to add the remote
    This is where I had the same problem of not being able to list Team Drive if I answer “Y” to this step. So I tried selecting “N” and then add the "team_drive = " in the rclone.conf file. This is the same id rclone config would generate if I use my own personal account, rather than the service account.

After failing here I tried going to Apps -> G Suite -> Drive and Docs -> Manage Team Drive, click on the drive, and add the Email for the service account as Content manager. The problem here is the email I find on IAM is of the form ‘@-229811.iam.gserviceaccount.com’, and when I hit Add it pop up a message saying ‘@-229811.iam.gserviceaccount.com is outside of . Only people inside can access files in this Team Drive.’

I then tried going to Apps -> G Suite -> Drive and Docs -> Shared settings, selecting Whitelisted Domains, and add ‘-229811.iam.gserviceaccount.com’ to the whitelist. Still doesn’t work…

I have checked and retried what I did many times against the instructions but still can’t get it to work. Any ideas?

That doesn’t look like an authentication problem, it looks like the directory doen’t exist…

What does this say?