Snapshots Plugin not transferring file to Dropbox

When creating a snapshot backup of my site it doesn't seem to want to transfer the file to dropbox. It always shows failed and then when I go to check on that destination it shows that it is no longer authorized. So I go through the steps to authorize it to access dropbox and it shows "yes" next to authorized. Then I attempt the backup again with the same result.

  • Paul
    • The Green Incsub

    @joshg01,

    Greetings. I can't say that I've see this issue of random de-authorization before. What Snapshot does is request from Dropbox a pair of OAuth keys. There is a public and private part. This key pair is stored into your wp_options database table and part of the data structure managed by Snapshot. Rarely does this change.

    I'll need more details on the issue if you can provide it. Realize that Dropbox solution will not work with all server configuration.

    So some questions.

    1. On the Snapshots > All Snapshots listing you should see in the far column 'Archives'. It should list the latest archive filename and the size of the archive. What is the archive size??

    2. Also in the same Archives column is a link to show the log file. When you view the log file do you see any errors related to Dropbox??

    3. Does your hosting provide access to the server logs?? In many cases it is the server that is for some reason resetting the connection. Many hosting configurations do not allow long running connections to external systems for security reasons. This prevents hackers from jumping through your site to other systems.

    4. Check your php.ini settings. Here are some of the PHP settings that seem to effect the Snapshot Dropbox. Note not all these will effect your specific server. Seems there are inconstancies in the server PHP implementations.

    upload_max_filesize - Make sure this is at least larger than your largest Snapshot file.
    post_max_size - Same as above

    max_execution_time - Make this at least 900 (15 minutes).
    max_input_time - same as above
    default_socket_timeout - same as above

    memory_limit - Doubt this is the issue. The memory limit is generally the issue during the archive creation. If your archive appear to be created fine then leave this at the current default.

  • joshg01
    • WPMU DEV Initiate

    Thanks Paul. I have used other plugins that transfer files to dropbox before but I don't think I was transferring a large archive at the time. I made some changes to my php file per your suggestion and chose the resend option on the archive. The file size is 93MB so that could have something to do with it.

    It still shows pending at the moment but I will let you know if it worked.

  • joshg01
    • WPMU DEV Initiate

    Ok looking at the logs it looks like it is stuck in a loop. The interesting thing is I checked the destination and it said it was authorized before I started attempting the transfer. Here's an excerpt from the log..

    2013-02-08 07:31:00: ERROR: Forbidden. This could mean a bad OAuth request, or a file or folder already existing at the target location.
    2013-02-08 07:34:47: Sending Archive: snapshot-1356559668-130207-154138-e5d48ab7.zip 93.48M
    2013-02-08 07:34:47: Destination: dropbox: Dropbox
    2013-02-08 07:36:01: Sending to Dropbox Directory:disappointed:
    2013-02-08 07:36:01: ERROR: Forbidden. This could mean a bad OAuth request, or a file or folder already existing at the target location.
    2013-02-08 07:39:46: Sending Archive: snapshot-1356559668-130207-154138-e5d48ab7.zip 93.48M
    2013-02-08 07:39:46: Destination: dropbox: Dropbox
    2013-02-08 07:41:20: Sending to Dropbox Directory:disappointed:
    2013-02-08 07:41:20: ERROR: Forbidden. This could mean a bad OAuth request, or a file or folder already existing at the target location.
    2013-02-08 07:45:03: Sending Archive: snapshot-1356559668-130207-154138-e5d48ab7.zip 93.48M
    2013-02-08 07:45:03: Destination: dropbox: Dropbox
    2013-02-08 07:46:40: Sending to Dropbox Directory:disappointed:
    2013-02-08 07:46:40: ERROR: Forbidden. This could mean a bad OAuth request, or a file or folder already existing at the target location.
    2013-02-08 07:49:44: Sending Archive: snapshot-1356559668-130207-154138-e5d48ab7.zip 93.48M
    2013-02-08 07:49:44: Destination: dropbox: Dropbox
    2013-02-08 07:50:59: Sending to Dropbox Directory:disappointed:
    2013-02-08 07:50:59: ERROR: Forbidden. This could mean a bad OAuth request, or a file or folder already existing at the target location.
    2013-02-08 07:55:07: Sending Archive: snapshot-1356559668-130207-154138-e5d48ab7.zip 93.48M
    2013-02-08 07:55:07: Destination: dropbox: Dropbox
    2013-02-08 07:56:20: Sending to Dropbox Directory:disappointed:
    2013-02-08 07:56:20: ERROR: Forbidden. This could mean a bad OAuth request, or a file or folder already existing at the target location.
    2013-02-08 08:00:12: Sending Archive: snapshot-1356559668-130207-154138-e5d48ab7.zip 93.48M
    2013-02-08 08:00:12: Destination: dropbox: Dropbox

  • joshg01
    • WPMU DEV Initiate

    Removed my current snapshots and the snapshot plugin by uninstalling. Uploaded/installed the version you just gave me. Created the dropbox destination again and authorized it. I still get a failed message. Here are the last few lines of the log file...

    2013-02-08 09:42:58: finish: snapshot-1360341231-130208-164117-5b4c1ede.zip
    2013-02-08 09:42:58: Sending Archive: snapshot-1360341231-130208-164117-5b4c1ede.zip 93.26M
    2013-02-08 09:42:58: Destination: dropbox: Main Dropbox
    2013-02-08 09:42:59: Using Dropbox API type (CURL)
    2013-02-08 09:42:59: Sending to Dropbox Directory:disappointed:
    2013-02-08 09:42:59: ERROR: Uploading file to Dropbox failed
    2013-02-08 09:43:04: Sending Archive: snapshot-1360341231-130208-164117-5b4c1ede.zip 93.26M
    2013-02-08 09:43:04: Destination: dropbox: Main Dropbox
    2013-02-08 09:43:05: Using Dropbox API type (CURL)
    2013-02-08 09:43:05: Sending to Dropbox Directory:disappointed:
    2013-02-08 09:43:05: ERROR: Uploading file to Dropbox failed

  • Paul
    • The Green Incsub

    Well that tells us absolutely nothing. Hmm. Thinking. Do you have access to your server logs via your hosting control panel? Any chance those can be reviewed to see if there is some server error being thrown not captured by the PHP code.

    Also, on the Snapshots > Settings panel at the bottom is a section for Error Reporting. Make sure all the checkboxes are set. This should output some details to the log.

  • joshg01
    • WPMU DEV Initiate

    The error logs that I find in my cpanel are showing empty. There is a logs folder in my ftp but it is also empty. I'm guessing this means I don't have access to them.

    I checked and all of the error reporting was already turned on in snapshot settings.

    Is there a particular PEAR extension that must be installed? There is a "PHP Pear Packages" link in my cpanel which then shows there are no packages installed.

    I'll enable WP_DEBUG. Then try running it again?

  • joshg01
    • WPMU DEV Initiate

    I just can't win... i'll just paste it in

    2013-02-08 11:52:19: file: wp-content/themes/twentytwelve/page-
    
    templates/full-width.php
    2013-02-08 11:52:21: memory limit: 256M: memory usage current: 53M: memory 
    
    usage peak: 74M
    2013-02-08 11:52:21: finish: snapshot-1360349234-130208-185117-b7b4255d.zip
    2013-02-08 11:52:21: Sending Archive: snapshot-1360349234-130208-185117-
    
    b7b4255d.zip 93.28M
    2013-02-08 11:52:21: Destination: dropbox: Dropbox Folder
    2013-02-08 11:52:22: Using Dropbox API type (CURL)
    2013-02-08 11:52:22: Sending to Dropbox Directory:/
    2013-02-08 11:52:22: ERROR: Uploading file to Dropbox failed 
    
    result<pre>Array
    (
        [body] =>
        [httpStatus] => 401
    )
    </pre> url=
    
    [https://api-content.dropbox.com/1/chunked_upload?offset=0]  
    
    headers<pre>Array
    (
        [Content-Type] => application/octet-stream;
    )
    </pre>
    2013-02-08 11:55:52: Sending Archive: snapshot-1360349234-130208-185117-
    
    b7b4255d.zip 93.28M
    2013-02-08 11:55:52: Destination: dropbox: Dropbox Folder
    2013-02-08 11:55:53: Using Dropbox API type (CURL)
    2013-02-08 11:55:53: Sending to Dropbox Directory:/
    2013-02-08 11:55:53: ERROR: Uploading file to Dropbox failed 
    
    result<pre>Array
    (
        [body] =>
    <html>
    <head><title>Dropbox - 5xx</title>
    <link href="https://www.dropbox.com/static/css/main.css" rel="stylesheet" 
    
    type="text/css">
    <link rel="shortcut icon" href="/static/images/favicon.ico"/>
    </head>
    <body style="background-color:#fff">
    <br/><br/>
    <div align="center">
    <table><tr><td width="600px">
    <center><img id="errorimage" src="/static/images/sickbox.png"/></center>
    <div id="errorbox">
    <h1>Error</h1>Something went wrong. Don't worry, your files are still safe 
    
    and the Dropboxers have been notified. Check out our <a 
    
    href="https://www.dropbox.com/help">Help Center</a> and <a 
    
    href="http://forums.dropbox.com">forums</a> for help, or head back to <a 
    
    href="https://www.dropbox.com/home">home</a>.
    </div>
    </td></tr></table>
    </div>
    
    <script type="text/javascript" 
    
    src="/static/javascript/external/prototype.js"></script>
    <script>
    message = {"fr": "\x3ch1>Error\x3c/h1>Something went wrong. Don't worry, your 
    
    files are still safe and the Dropboxers have been notified. Check out our 
    
    \x3ca href=\"https://www.dropbox.com/help\">Help Center\x3c/a> and \x3ca 
    
    href=\"http://forums.dropbox.com\">forums\x3c/a> for help, or head back to 
    
    \x3ca href=\"https://www.dropbox.com/home\">home\x3c/a>.", "de": 
    
    "\x3ch1>Fehler\x3c/h1>Es ist etwas schief gelaufen. Keine Angst, deine 
    
    Dateien sind weiterhin sicher und die Dropboxer wurden benachrichtigt. Suche 
    
    im \x3ca href=\"https://www.dropbox.com/help\">Hilfecenter\x3c/a> oder in den 
    
    \x3ca href=\"http://forums.dropbox.com\">Foren\x3c/a> nach Hilfe. Oder geh 
    
    zur\u00fcck zur \x3ca href=\"https://www.dropbox.com/home\">Startseite
    
    \x3c/a>.", "ko": "\x3ch1>\uc624\ub958\x3c/h1>\ubb38\uc81c\uac00 \ubc1c\uc0dd
    
    \ud588\uc2b5\ub2c8\ub2e4. \ud30c\uc77c\uc774 \uc190\uc0c1\ub418\uc9c0 \uc54a
    
    \uc558\uc73c\ubbc0\ub85c \uc548\uc2ec\ud558\uc2dc\uae30 \ubc14\ub77c\uba70, 
    
    \uc774 \ubb38\uc81c\ub294 Dropboxer \uc0ac\uc6a9\uc790\uc5d0\uac8c 
    
    \ud1b5\ubcf4\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \ub3c4\uc6c0\uc774 
    
    \ud544\uc694\ud55c \uacbd\uc6b0 Dropbox\uc758 \x3ca href=
    
    \"https://www.dropbox.com/help\">\ub3c4\uc6c0\ub9d0 \uc13c\ud130\x3c/a> 
    
    \ubc0f \x3ca href=\"http://forums.dropbox.com\">\ud3ec\ub7fc\x3c/a>\uc744 
    
    \ucc38\uc870\ud558\uac70\ub098 \x3ca href=\"https://www.dropbox.com/home\">
    
    \ud648\x3c/a>\uc73c\ub85c \ub3cc\uc544\uac00\uc138\uc694.", "ja": "\x3ch1>
    
    \u30a8\u30e9\u30fc\x3c/h1>\u6240\u5b9a\u306e\u51e6\u7406\u304c\u5b8c
    
    \u4e86\u3057\u307e\u305b\u3093\u3067\u3057\u305f
    
    \u3002\u3054\u5229\u7528\u306e\u30d5\u30a1\u30a4\u30eb\u306f
    
    \u5b89\u5168\u306b\u4fdd\u5b58\u3055\u308c\u3066\u304a\u308a\u3001Dropbox 
    
    \u30b9\u30bf\u30c3\u30d5\u306b\u554f\u984c\u306e\u901a\u77e5\u304c
    
    \u9001\u3089\u308c\u3066\u3044\u307e\u3059\u3002\x3ca href=
    
    \"https://www.dropbox.com/help\">\u30d8\u30eb\u30d7\u30bb\u30f3\u30bf\u30fc
    
    \x3c/a>\u3068\x3ca href=\"http://forums.dropbox.com\">\u30d5\u30a9\u30fc
    
    \u30e9\u30e0\x3c/a>\u3067\u4e0d\u660e\u306a\u70b9\u3092\u304a\u8abf
    
    \u3079\u304f\u3060\u3055\u3044\u3002\u307e\u305f\u306f\u3001\x3ca href=
    
    \"https://www.dropbox.com/home\">\u30db\u30fc\u30e0\x3c/a>\u306b\u623b
    
    \u3063\u3066\u304f\u3060\u3055\u3044\u3002", "es": "\x3ch1>Error\x3c/h1>Algo 
    
    sali\u00f3 mal. No te preocupes; tus archivos a\u00fan est\u00e1n a salvo y 
    
    los dropboxers han recibido una notificaci\u00f3n. Consulta el \x3ca href=
    
    \"https://www.dropbox.com/help\">Centro de ayuda\x3c/a> y los \x3ca href=
    
    \"http://forums.dropbox.com\">foros\x3c/a> para obtener ayuda o vuelve al 
    
    \x3ca href=\"https://www.dropbox.com/home\">Inicio\x3c/a>."};
    function read_cookie (name) {
    	    var nameEQ = name + "=";
    	    var ca = document.cookie.split(';');
    	    for (var i = 0; i < ca.length; i++) {
    		    var c = ca[i];
    		    while (c.charAt(0) == ' ') {
                    c = c.substring(1, c.length);
                }
    		    if (c.indexOf(nameEQ) === 0) {
                    return c.substring(nameEQ.length, c.length);
                }
    	    }
    	    return null;
    }
    Event.observe(document, 'dom:loaded', function () {
        var locale = read_cookie('locale');
        if (locale) {
           var msg = message[locale];
           if (msg) {
               $('errorbox').update(msg);
           }
        }
    });
    </script>
    
    </body>
    </html>
        [httpStatus] => 502
    )
    </pre> url=[https://api-
    
    content.dropbox.com/1/chunked_upload?offset=0]  headers<pre>Array
    (
    
    [Content-Type] => application/octet-stream;
    )
    </pre>
  • Paul
    • The Green Incsub

    So seeing the 401 HTTP status indicated unauthorized access. Meaning something is not connecting with your access keys from the destination setup.

    So went off to the Dropbox forums to see if this might be helpful. Found many reporting the same issue. But sadly no solution. Is it possible that I can login and try my own Dropbox account. Using a different account might have a different effect.

    Other than that maybe something with your hosting. But you wrote previous that had used Dropbox plugins prior. Sorry. I'm guessing and drawing straws here.

  • joshg01
    • WPMU DEV Initiate

    It has to be something to do with the file type or file size because I just changed from the archive to the mirror and the mirror option seems to be transferring fine. I really don't want to do it this way. In fact that's one of the reasons I went with snapshot was for the ability to have it in a zip archive which takes up less space and is easily restored.

  • Paul
    • The Green Incsub

    Understood. So just thinking out load I know Snapshot has this logic split for Dropbox. The logic is if the archive file is under 4mb it uses the logic to send the file as a single file. But if the file is large is uses some 'chunked' logic provided by the Dropbox API library we are using. This 'chunked' logic gets past the 150mb file size limit imposed by Dropbox.

    So that you can send small files tells me the first logic option seems to be working. So I'm trying to understand why the 'chunked' logic does not seem to be working on your site.

  • Paul
    • The Green Incsub

    @joshg01,

    Well good news. I fired up my local dev site running the same beta 2 you are running. I created a 180Mb archive. Seeing the same error in my logs. Wondering it Dropbox made some changes to the API. So sit tight. Let me dig into the code and will get back to you later this afternoon.

  • Paul
    • The Green Incsub

    @joshg01, I'm not making any head way with this Dropbox Library from Google we are using. I can only get the PEAR version to work for the 'chunked' send. So for now you might want to revert back to the base Snapshot release 2.3.1. Though that really will not help you out.

  • joshg01
    • WPMU DEV Initiate

    Installed Beta 3 and ran it again just like I have been. This time the file transferred successfully! I don't know if it is something that you changed or something that dropbox changed but it looks like it is actually working now.

    Here is the dropbox part of the log file in case you need it.

    2013-02-12 10:21:40: memory limit: 256M: memory usage current: 52.5M: memory usage peak: 61.25M
    2013-02-12 10:21:40: finish: snapshot-1360689416-130212-172045-89f0bb91.zip
    2013-02-12 10:21:40: Sending Archive: snapshot-1360689416-130212-172045-89f0bb91.zip 93.8M
    2013-02-12 10:21:40: Destination: dropbox: My Dropbox
    2013-02-12 10:21:40: Sending file chunked. Offset: 0/98355002 (0%)
    2013-02-12 10:21:44: Sending file chunked. Offset: 4194304/98355002 (4%)
    2013-02-12 10:21:48: Sending file chunked. Offset: 8388608/98355002 (8%)
    2013-02-12 10:21:51: Sending file chunked. Offset: 12582912/98355002 (12%)
    2013-02-12 10:21:54: Sending file chunked. Offset: 16777216/98355002 (17%)
    2013-02-12 10:21:58: Sending file chunked. Offset: 20971520/98355002 (21%)
    2013-02-12 10:22:01: Sending file chunked. Offset: 25165824/98355002 (25%)
    2013-02-12 10:28:05: Sending Archive: snapshot-1360689416-130212-172045-89f0bb91.zip 93.8M
    2013-02-12 10:28:05: Destination: dropbox: My Dropbox
    2013-02-12 10:28:05: Sending file chunked. Offset: 0/98355002 (0%)
    2013-02-12 10:28:09: Sending file chunked. Offset: 4194304/98355002 (4%)
    2013-02-12 10:28:12: Sending file chunked. Offset: 8388608/98355002 (8%)
    2013-02-12 10:28:15: Sending file chunked. Offset: 12582912/98355002 (12%)
    2013-02-12 10:28:18: Sending file chunked. Offset: 16777216/98355002 (17%)
    2013-02-12 10:28:22: Sending file chunked. Offset: 20971520/98355002 (21%)
    2013-02-12 10:28:25: Sending file chunked. Offset: 25165824/98355002 (25%)
    2013-02-12 10:28:28: Sending file chunked. Offset: 29360128/98355002 (29%)
    2013-02-12 10:28:31: Sending file chunked. Offset: 33554432/98355002 (34%)
    2013-02-12 10:28:34: Sending file chunked. Offset: 37748736/98355002 (38%)
    2013-02-12 10:28:36: Sending file chunked. Offset: 41943040/98355002 (42%)
    2013-02-12 10:28:39: Sending file chunked. Offset: 46137344/98355002 (46%)
    2013-02-12 10:28:42: Sending file chunked. Offset: 50331648/98355002 (51%)
    2013-02-12 10:28:46: Sending file chunked. Offset: 54525952/98355002 (55%)
    2013-02-12 10:28:49: Sending file chunked. Offset: 58720256/98355002 (59%)
    2013-02-12 10:28:52: Sending file chunked. Offset: 62914560/98355002 (63%)
    2013-02-12 10:28:56: Sending file chunked. Offset: 67108864/98355002 (68%)
    2013-02-12 10:28:59: Sending file chunked. Offset: 71303168/98355002 (72%)
    2013-02-12 10:29:02: Sending file chunked. Offset: 75497472/98355002 (76%)
    2013-02-12 10:29:06: Sending file chunked. Offset: 79691776/98355002 (81%)
    2013-02-12 10:29:10: Sending file chunked. Offset: 83886080/98355002 (85%)
    2013-02-12 10:29:13: Sending file chunked. Offset: 88080384/98355002 (89%)
    2013-02-12 10:29:17: Sending file chunked. Offset: 92274688/98355002 (93%)
    2013-02-12 10:29:22: Sending file chunked. Offset: 96468992/98355002 (98%)
    2013-02-12 10:29:24: Sending file chunked commit url: https://api-content.dropbox.com/1/commit_chunked_upload/sandbox/snapshot-1360689416-130212-172045-89f0bb91.zip?upload_id=bpm_o8q5C2Uq57_W7WYQeA
    2013-02-12 10:29:27: Sending to Dropbox Directory:disappointed:
    2013-02-12 10:29:27: Send file success: snapshot-1360689416-130212-172045-89f0bb91.zip

  • Paul
    • The Green Incsub

    @joshg01, Perfect! That was the effect I was going for. I did make one small change. Not to bury you with details but in the Snapshot code when it gets to the 'Sending file chunked commit' part there was some cases where there was an extra '/' in the URL. I'm assuming Dropbox does not like this. So corrected that bit of logic and was able to get this working early this morning on my end.

    So sent out the beta for you and another member to verify. Let's let this run a few cycles to make sure you are all fixed up. Then I'll submit this fix and release a new version.

    Thanks for your patience while I figured out the non-descriptive Dropbox error message. :slight_smile:

  • wpcdn
    • Syntax Hero

    I get failure backing up to Dropbox.

    2013-04-17 22:16:30: Sending to Dropbox Directory:disappointed:
    2013-04-17 22:16:30: ERROR: Forbidden. This could mean a bad OAuth request, or a file or folder already existing at the target location.

    Any ideas?

    Is there a certain port used for backup perhaps?

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.