cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 

swifty dropbox route error incorrect offset

swifty dropbox route error incorrect offset

mickedg
Helpful | Level 6

Hi - I'm using Swifty Dropbox to upload individual files to another dropbox using 

let dbClient = DropboxClient(accessToken: "xxxxx....."

and the methods

func doUpload(fileName: String)
func uploadFirstChunk()
func uploadNextChunk()

In this part:

dbClient.files.uploadSessionAppendV2(cursor: Files.UploadSessionCursor(sessionId: self.sessionId, offset: UInt64(offset)), input: data!)
                .response { response, error in
                    if error == nil {
                        self.offset += self.chunkSize
                        self.uploadProgress = Double(self.offset)/Double(self.videoFileSize)
                        self.progressView.progress = Float(self.uploadProgress)
                        self.uploadNextChunk()
                        
                    } else if let callError = error {


I' ve seen Route Error/IncorrectOffset: {"correct_offset" = 1048576;}. 

A beta tester has also reported it. It's not consistent, I only get it occasionally.

What does it mean?

 

4 Replies 4

mickedg
Helpful | Level 6

I found this explanation for the Incorrect Offset error: "The specified offset was incorrect. See the value for the correct offset. This error may occur when a previous request was received and processed successfully but the client did not receive the response, e.g. due to a network error."

Is there anything I can do if this error is very frquent?

Greg-DB
Dropbox Staff
That's the correct documentation for this error. It generally shouldn't happen often, but if it does, it may indicate an issue with your upload session logic that you should debug.

When you do get it though, you can have your app continue with the upload session, but pick it up from the specified correct offset. For example, in this case the API indicated that it received data up to offset 1048576 so far, so your app should continue the upload session by uploading further portions of data starting at offset 1048576.

mickedg
Helpful | Level 6

Thanks Greg! I've lowered the chunk size to 1 MB, could that be the problem? I wanted to do that in order to get a smoother progress view. The files that I'm uploading are typically around 100 - 200 MB. What would be the optimal chunk size from a performance perspective?

Greg-DB
Dropbox Staff
You can use whatever chunk size you want, and the chunk size itself shouldn't cause an incorrect offset error.

There isn't an optimal chunk size in general, as there are various different factors, often app-specific, or even user-specific, that will come in to play to affect this. That being the case, you may want to try a few different ones to see what works best for your app. In general though, the larger the chunk size, the better the performance, as there's less overhead associated with making more separate network requests. The bigger the chunk size though, the more likely any particular is to fail.
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    mickedg Helpful | Level 6
What do Dropbox user levels mean?