Forum Discussion

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

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?