Dropbox Backup: Access token not found

Dear ERPNext team,

I am using the VirtualBox image of ERPNext and sucessfully registered a new Dropbox app of type “sync” with ERPNext’s auto-backup feature.

However, all backups so far have failed due to an “Access token not found” error.

This is the complete backtrace:

Error message: 
Traceback (innermost last):
  File "/home/erpnext/frappe-bench/apps/erpnext/erpnext/setup/doctype/backupmanager/backupmanager.py", line 33, in takebackupsdropbox
    didnotupload, errorlog = backuptodropbox()
  File "/home/erpnext/frappe-bench/apps/erpnext/erpnext/setup/doctype/backupmanager/backupdropbox.py", line 89, in backuptodropbox
    uploadfiletodropbox(filename, "/database", dropboxclient)
  File "/home/erpnext/frappe-bench/apps/erpnext/erpnext/setup/doctype/backupmanager/backupdropbox.py", line 146, in uploadfiletodropbox
    dropboxclient.putfile(folder + "/" + os.path.basename(filename), f, overwrite=True)
  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/dropbox/client.py", line 291, in putfile
    return self.restclient.PUT(url, fileobj, headers)
  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/dropbox/rest.py", line 321, in PUT
    return cls.IMPL.PUT(*n, **kw)
  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/dropbox/rest.py", line 258, in PUT
    return self.request("PUT", url, body=body, headers=headers, rawresponse=raw_response)
  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/dropbox/rest.py", line 227, in request
    raise ErrorResponse(r, r.read())
 ErrorResponse: [401] u'Access token not found.'

In frappe-bench/sites/erpnext-erpnext-vm/site_config.json I added Dropbox’ app key and access key like this:

{
    "dropbox_access_key": "**App key** provided by Dropbox",
    "dropbox_secret_key": "**App secret** provided by Dropbox"
}

I would like to know if you have heard of this error before.

Cheers,

Stefan

I thought about adding an issue on Github, but as the reason I cannot backup my data to Dropbox probably is probably my fault, I first wanted to post it here.

However, please let me know if I should go to Github instead.

Sorry for the late reply,

If you’ve added the token in site_config.json, this seems strange. Have you “allowed dropbox access” from setup,

ref: Not Found

Thanks for your reply.

I might have forgotten to allow the Dropbox app the required access.

However, during the registration process with Dropbox, opening the following page failed:
http://erpnext.erpnext-vm/?cmd=erpnext.setup.doctype.backup_manager.backup_dropbox.dropbox_callback&oauth_token=[...]&uid=[...]

Error message: Can’t find the server at erpnext.erpnext-vm

Could it be that Dropbox cannot connect to my ERPNext installation because I am using the ERPNext VirtualBox version?

Cheers,

Stefan

Yes, your instance must be accessible by Dropbox to return you the verification.

Is there a way to make my instance accessible to Dropbox although it is a VirtualBox image located on localhost?

Cheers,

Stefan

You can just replace erpnext.erpnext-vm part in the URL with hostname/ip with which you access ERPNext and it should be fine.

You can just replace erpnext.erpnext-vm part in the URL with hostname/ip with which you access ERPNext and it should be fine.

1 Like

In the URL string that appeared in the address bar during the initial authentication of ERPNext to the Dropbox app, I replaced
erpnext.erpnext-vm with localhost:8080 and after that everything worked as expected.

Thank you so much for your help!

Cheers,

Stefan