You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

feltj16's avatar
feltj16
Explorer | Level 4
2 years ago

Batch Upload session in Mobile Browser Error

Hi, I have build an dropbox uploader in the web using the  await dbx.filesUploadSessionStart and it works great in the desktop and mobile.

However It causes an error in the mobile browser if we select the files only from google drive. This error happens only in the mobile browser. There is a TypeError, Failed to fetch error, which I guess it might be cors issue ?

 

May I know how I can fix this ?

Thank you.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    I'll be happy to help with any issues you're having with the Dropbox API, but I'll need some more information. Please reply with:

     

    • the name and version number of the browser you are using
    • the version number of the Dropbox SDK you are using
    • the steps to reproduce the issue, including relevant code snippet(s), but don't include any access or refresh token(s)
    • the full text of any error or unexpected output
    • feltj16's avatar
      feltj16
      Explorer | Level 4
      • the name and version number of the browser you are using
        • Chrome in Mobile Android
        • Chrome 110.0.5481.65
        • Android 10
      • the version number of the Dropbox SDK you are using
      • the steps to reproduce the issue, including relevant code snippet(s), but don't include any access or refresh token(s)
        • It got error in the filesUploadSessionStart.

          .........
          var file = fileInput.files[i];
          var filename = fileInput.files[i].name;


          try {
          let res = await dbx.filesUploadSessionStart({
          contents: file,
          close: true,
          });
           
          }
          catch(err) {
                document.getElementById("v1").value += "error "+err+" : ";
          }
          var obj = res;
          var str = JSON.stringify(obj);
          ...
      • the full text of any error or unexpected output
        • Since its in mobile, there is no console for me to debug, but here is the error I can get -> TypeError: Failed to fetch
      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        Thanks for the additional information. I don't see anything clearly wrong in your code, and since it only happens with files from Google Drive, it sounds like there's something unique to how the files are returned from Google Drive.

         

        Can you try using Chrome Remote Debugging to see if you can get a more specific error?

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API

Make connections with other developers

795 PostsLatest Activity: 14 hours ago
194 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!