Error: Uncaught (in promise): RestError: Failed to send request
See original GitHub issueHi
PackageName: @azure/storage-blob Version : 12.2.1 Node: v14.4.0 OS : Windows
Here is my code for upload files to Blob:
public uploadFilesToAzureBlob(sasToken: string, file: any, id: string): Observable<any> {
const blobServiceClient = new BlobServiceClient(sasToken);
const containerClient = blobServiceClient.getContainerClient(id);
if (!containerClient.exists()) {
containerClient.create();
}
const client = containerClient.getBlockBlobClient(file.name);
// 10MB block size and 20 concurrency
const response = client.uploadBrowserData(file, {
blockSize: 10485760,
concurrency: 20,
blobHTTPHeaders: {
blobContentType: file.type
}
});
return from(response)
.pipe(map((res: any) => res),
catchError(this.handleError)); }
Getting below errors after 5-10 seconds of uploading the files, though file/s is/are successfully uploaded…
Any suggestion?
Error # 1 ERROR Error: Uncaught (in promise): RestError: Failed to send request to https://AzureBlobStorage/Files/FBEB2AE9-B14C-4C78-8F4A-0CE4FF9DF6F5/EDB62F71-6D1C-4347-B277-0D0BF98B9A1E?sv=2017-04-17&sr=c&sig=AnlnrIFDingda21arBI1mbA0yu2mqtAYehDEWNB5tA4%3D&se=2020-09-19T08%3A07%3A49Z&sp=rwdl&restype=container&_=9311731167285 RestError: Failed to send request to https://AzureBlobStorage/Files/FBEB2AE9-B14C-4C78-8F4A-0CE4FF9DF6F5/EDB62F71-6D1C-4347-B277-0D0BF98B9A1E?sv=2017-04-17&sr=c&sig=AnlnrIFDingda21arBI1mbA0yu2mqtAYehDEWNB5tA4%3D&se=2020-09-19T08%3A07%3A49Z&sp=rwdl&restype=container&_=9311731167285 at new RestError (restError.js:10) at XMLHttpRequest.<anonymous> (xhrHttpClient.js:142) at ZoneDelegate.invokeTask (zone-evergreen.js:399) at Object.onInvokeTask (core.js:41344) at ZoneDelegate.invokeTask (zone-evergreen.js:398) at Zone.runTask (zone-evergreen.js:167) at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:480) at invokeTask (zone-evergreen.js:1621) at XMLHttpRequest.globalZoneAwareCallback (zone-evergreen.js:1647) at resolvePromise (zone-evergreen.js:798) at zone-evergreen.js:705 at rejected (tslib.es6.js:72) at ZoneDelegate.invoke (zone-evergreen.js:364) at Object.onInvoke (core.js:41366) at ZoneDelegate.invoke (zone-evergreen.js:363) at Zone.run (zone-evergreen.js:123) at zone-evergreen.js:857 at ZoneDelegate.invokeTask (zone-evergreen.js:399) at Object.onInvokeTask (core.js:41344)
Error # 2 GET https://<AzureBlobStorage>/Files/FBEB2AE9-B14C-4C78-8F4A-0CE4FF9DF6F5/EDB62F71-6D1C-4347-B277-0D0BF98B9A1E?sv=2017-04-17&sr=c&sig=AnlnrIFDingda21arBI1mbA0yu2mqtAYehDEWNB5tA4%3D&se=2020-09-19T08%3A07%3A49Z&sp=rwdl&restype=container&_=9311731167285 net::ERR_FAILED
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:13 (5 by maintainers)
Top GitHub Comments
Hi, these errors are from network layer, usually caused by network spike. Please double check uploaded data integrity, although blob is created. Recommend to increase max retry count in client options if you want to deal with some bad network situations.
Check out this page, It solves the CORS issue.
https://docs.microsoft.com/en-us/azure/developer/javascript/tutorial/browser-file-upload-azure-storage-blob#7-configure-cors-for-azure-storage-resource