RC / Api can't find service account credentials

What is the problem you are having with rclone?

Trying to run Rclone on an Electron app.
I start the RC server alongside Electron, however when I tried to copy a folder I got an error that it was unable to locate my credentials.json for my service account.
FYI I'm a complete beginner when it comes to coding (Only done some stuff on Python), Electron and JS, so maybe my approach here is completely wrong :confused:

Run the command 'rclone version' and share the full output of the command.

rclone v1.56.2

  • os/version: Microsoft Windows 10 IoT Enterprise LTSC 2021 2009 (64 bit)
  • os/kernel: 10.0.19044.1526 (x86_64)
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.16.8
  • go/linking: dynamic
  • go/tags: cmount

Which cloud storage system are you using? (eg Google Drive)

Google Drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone rcd --rc-no-auth
rclone rc sync/copy srcFs="remote:/Test" dstFs="E:/rclone/Test" createEmptySrcDirs=True

All these commands are run from the Main process of Electron however

import { execFile } from 'child_process';

      rcloneExe, // The path to the local rclone.exe, defined previously
      ['rcd', '--rc-no-auth', '-vv'],
      (error, stdout, stderr) => {
        if (error) {
          throw error;
        console.log(`stdout: ${stdout}`);
        console.log(`stderr: ${stderr}`);

// A handle that I can call on Electron's renderer process later on
ipcMain.handle('rclone-test', async () => {
    (error, stdout, stderr) => {
      if (error) {
        throw error;

The rclone config contents with secrets removed.

type = drive
client_id = *
scope = drive
client_secret = *
token = *
root_folder_id =
team_drive = *
service_account_file = credentials.json // Located right next to the exe and this config

type = crypt
remote = remote:
directory_name_encryption = false
password = *
password2 = *

A log from the command with the -vv flag

Error: Command failed: D:\Projects\electron-app\assets\rclone\rclone.exe rc sync/copy srcFs=remote:/Test dstFs=E:/rclone/Test createEmptySrcDirs=True -vv
2022/03/02 10:41:38 DEBUG : rclone: Version "v1.56.2" starting with parameters ["D:\\Projects\\electron-app\\assets\\rclone\\rclone.exe" "rc" "sync/copy" "srcFs=remote:/Test" "dstFs=E:/rclone/Test" "createEmptySrcDirs=True" "-vv"]
2022/03/02 10:41:38 DEBUG : 4 go routines active
2022/03/02 10:41:38 Failed to rc: Failed to read rc response: 500 Internal Server Error: {
        "error": "drive: failed when making oauth client: error opening service account credentials file: open credentials.json: The system cannot find the file specified.",
        "input": {
                "createEmptySrcDirs": "True",
                "dstFs": "E:/rclone/Test",
                "srcFs": "remote:/Test"
        "path": "sync/copy",
        "status": 500

    at ChildProcess.exithandler (node:child_process:406:12)
    at ChildProcess.emit (node:events:394:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'D:\\Projects\\electron-app\\assets\\rclone\\rclone.exe rc sync/copy srcFs=remote:/Test dstFs=E:/rclone/Test createEmptySrcDirs=True -vv'

If you put the full path here it will work.

Or change directory to that directory

Thank you!
Added a { cwd: 'path/to/rclone' } on the execfile calls and it works now, didn't think it would be that easy :sweat_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.