locked
SPFx Webpart - TypeError : Failed to fetch RRS feed

  • Question

  • I have written below code in SPFx Webpart to upload file to Sharepoint Library.

    It gives me error sometimes like TypeError : Failed to fetch.

    Can anyone give me some idea what this error signifies and how can it be resolved.

    function uploadFile(myfile, target) { var dfd = $.Deferred(); sp.web.webs.filter("Title eq 'DMS'").get().then(webData => { const _web = Web(webData[0].Url); //for files < 10 MB if (myfile.size <= 10485760) { _web.getFolderByServerRelativeUrl(target).files.add(myfile.name, myfile, true).then((result) => { dfd.resolve(result); }).catch(err => { dfd.reject(err + ". Error in method: uploadFile while uploading File"); }); } //for files > 10 MB else { _web.getFolderByServerRelativeUrl(target) .files.addChunked(myfile.name, myfile) .then(({ file }) => file.getItem()).then((item: any) => { dfd.resolve(item); }).catch(err => { dfd.reject(err + ". Error in method: uploadFile while uploading File"); }); } }).catch(err => { dfd.reject(err + ". Error in method: uploadFile while getting web"); }); return dfd.promise(); }



    • Edited by Praveen_ Tuesday, November 10, 2020 4:58 PM
    Tuesday, November 10, 2020 4:54 PM