Open armthanachot opened 1 year ago
I have no idea for run on web for now. But I have released azblob 3.0.0 that uses universal_io for internal http clients. You may be try them.
Thank you,
Any update to this?
You can use azblob 3.0.1 on web. If you not, please show the reproduce code and show all the error messages.
As a side note. Azure Storage is not CORS enabled by default. You need to enable it yourself.
List CORS settings
az storage cors list --connection-string=$CS
Add CORS settings
az storage cors add --methods 'GET,POST,PUT,DELETE' --origins '*' --services=b --allowed-headers=authorization,x-ms-date,x-ms-version --connection-string=$CS
($CS is your connection string)
Thanks,
Azblob does definitely not support web, as it depends on Universal IO, which despite claiming to support web, does not.
dart-sdk/lib/async/stream_impl.dart 402:7 [_sendDone] dart-sdk/lib/async/stream_impl.dart 291:7 [_close] dart-sdk/lib/async/stream_transformers.dart 87:11 [_close] dart-sdk/lib/async/stream_transformers.dart 21:5 close dart-sdk/lib/convert/string_conversion.dart 241:5 close dart-sdk/lib/convert/string_conversion.dart 295:7 close dart-sdk/lib/convert/chunked_conversion.dart 78:5 close dart-sdk/lib/async/stream_transformers.dart 132:7 [_handleDone] dart-sdk/lib/async/zone.dart 1582:9 runGuarded dart-sdk/lib/async/stream_impl.dart 392:7 sendDone dart-sdk/lib/async/stream_impl.dart 402:7 [_sendDone] dart-sdk/lib/async/stream_impl.dart 534:13 perform dart-sdk/lib/async/stream_impl.dart 620:10 handleNext dart-sdk/lib/async/stream_impl.dart 591:7 callback dart-sdk/lib/async/schedule_microtask.dart 40:11 _microtaskLoop dart-sdk/lib/async/schedule_microtask.dart 49:5 _startMicrotaskLoop dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 181:7 <fn>
I’m currently working next release.
It will work without universal_io
.
And it will work on flutter-web too.
Have a good weekend!
Thank you for your patience.
I have released the next version of azblob
as 4.0.0.
This version uses http
instead of universal_io
for HTTP client requests.
The public API are almost compatible I think.
You can try this.
Any feedbacks are appriciated.
Please dont forget CORS enabled for using Azure Storage from Web.
az storage cors add --methods 'GET,POST,PUT,DELETE' --origins '*' --services=b --allowed-headers=authorization,x-ms-blob-type,x-ms-date,x-ms-version --connection-string=$your_conn_str
I can confirm that this works on Flutter web!
This is still not working on web:
await storage.putBlob('reports/test.pdf', bodyBytes: file.files.first.bytes, contentType: 'application/pdf');
Error:
The MAC signature found in the HTTP request '...' is not the same as any computed signature
@noahjoshua could you try this?
await storage.putBlob('/reports/test.pdf', bodyBytes: file.files.first.bytes, contentType: 'application/pdf');
//---------------------^ path starts with slash (/)
Already did, still same result unfortunately
Apologies, I've found the issue in the package being outdated on my end :)
i got error when i run on web
pubspec.yaml
ClientException: XMLHttpRequest error., uri=https://fileStore1.blob.core.windows.net/myfile/pdf-27-11-2023-15-58-4-0-0.pdf