Giter Site home page Giter Site logo

aws_s3_plugin's Introduction

Borala Liyanage Asanka ๐Ÿ‘จโ€๐Ÿ’ป :bowtie:

Youtube creator | Blogger | Open source contributor

Github Badge Linkedin Badge Stackoverflow Badge Gmail Badge Whatsapp Badge Facebook Badge

Hi! I'm Asanka, a Sri Lankan Software Engineer mostly working on mobile development and a lover of Flutter framework. I'm have a Bsc in Information Technology. Learning new technologies, developing ideas and helping other programmers around the world is my pleasure.

Languages that I'm having experience:

  • Dart
  • Java
  • Kotlin
  • Swift
  • Javascript
  • Python
  • PHP

Looking forward to support from knowledge or with a software solution. ๐Ÿ†“

aws_s3_plugin's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aws_s3_plugin's Issues

Upload error. TransferNetworkLossHandler is not created.

E/TransferNetworkLossHand(17927): TransferNetworkLossHandler is not created. Please call TransferNetworkLossHandler.getInstance(Context) to instantiate it before retrieving

E/UploadTask(17927): TransferUtilityException: [com.amazonaws.mobileconnectors.s3.transferutility.TransferUtilityException: TransferNetworkLossHandler is not created. Please call TransferNetworkLossHandler.getInstance(Context) to instantiate it before retrieving]

image

PlatformException with release version

I'm seeing the following error in logcat when testing a release version of my APK. Everything works fine when the APK is a debug version.

06-15 14:27:53.506 10592-10621/? E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'b.a.y.b.a.i b.a.y.b.a.q.a(java.lang.String, java.lang.String, java.io.File, b.a.b0.c.g.e)' on a null object reference, null)
                                            #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569)
                                            #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156)
                                            <asynchronous myapp>
                                            #2      AwsS3.uploadFile (package:aws_s3/aws_s3.dart:43)
                                            <asynchronous myapp>
                                            #3      RecordPageState.uploadVideo (package:myapp/main.dart:474)
                                            <asynchronous myapp>
                                            #4      RecordPageState.onUploadButtonPressed (package:myapp/main.dart:380)
                                            <asynchronous myapp>

Flutter version: v1.17.0
aws_s3 version: ^0.1.1+hotfix.5
Device: OnePlus 6, Android 10

Has anyone else experienced this? Happy to provide more information/code if necessary.

Usage:

Future<void> uploadVideo() async {
    final Directory extDir = await getApplicationDocumentsDirectory();
    final String filePath = '${extDir.path}/xxx.mp4';

    AwsS3 awsS3 = AwsS3(
      awsFolderPath: "xxx",
      file: File(filePath),
      fileNameWithExt: "xxx.mp4",
      poolId: "xxx",
      region: Regions.EU_WEST_1,
      bucketName: "xxx"
    );

      String result = await awsS3.uploadFile;
      debugPrint(result);
  }

Update to nulll safety

We are dependent on this plugin from sol long.
Now that the flutter 2.5 is released, please update this plugin to latest so we can move our projects to null safety too.

Failed to upload csv/json file to aws s3 through flutter app

So, I am developing an app using flutter sdk in android studio which will capture the motion sensor data and geolocator data. These data will be stored into a file (csv/ json/ bin) and that file will be uploaded into that specific bucket every 1 hour through my flutter app.

I have tried to upload data into S3 bucket using http class but this is not working. Again, everywhere there are many resources for uploading images. There are less resources for uploading file. I have also tried to use aws lambda but all tutorials are about uploading images.

Can anyone suggest me any way/tutorial/documentation about how can I upload files through my flutter to AWS S3 bucket? A code snippet is given below about how I am trying to upload data into s3 bucket.

` DatabaseHelper db = DatabaseHelper();

static const String _csvHeader = "Accelerometer, UserAccelerometer, Gyroscope, latitude-longitude\n";
List entries = [];

addEntry() async{
  var res = await db.queryGeoAll();  //to get all data of geolocator from database
  var geoCSV = mapListToCsv(res);    //converting them into a csv file
  entries.add("$accelerometer, $userAccelerometer, $gyroscope, $geoCSV");
}

clearEntries() {
  accelerometer= null;
  userAccelerometer= null;
  gyroscope= null;
  latitudeData= null;
  location = null;
  entries.clear();
}

void uploadSensor() async{
  String csvContent = entries.join("\n");
  print(csvContent);

  Uri uri = Uri.parse("Bucket Adress");
  http.MultipartRequest request = new http.MultipartRequest("POST", uri);
  request.files.add(new http.MultipartFile.fromString("csv", _csvHeader + csvContent));

  try {
    return await request.send().then((response) {
      if (response.statusCode == 200) {
        clearEntries();
        return true;
      } else {
        return false;
      }
    });
  } catch (e) {
    print(e.toString());
    //return false;
  }
}`

Here, I am getting an error like:
I/flutter ( 394): SocketException: Failed host lookup: 's3.us-east-1.aws.amazonaws.com' (OS Error: No address associated with hostname, errno = 7)
I have already added the following line to Android Manifest file
<uses-permission android:name="android.permission.INTERNET"/>

uploading_status result in out of box

Hi,
I'm using this plugins for upload file in s3 bucket, its working fine but there few issues that I found in my app with using this plugin,
1), Progress value goes to out of the box means percentage result in more than 100 (iOS only).
2) Initialisation of plugin take lots of time.
If any one have solution then please let me know.

Android need set region when initialize AmazonS3Client

transferUtility1 = TransferUtility.builder().context(mContext).awsConfiguration(AWSMobileClient.getInstance().getConfiguration()).s3Client(new AmazonS3Client(credentialsProvider)).build();

I catch an error when upload in android device.
I guess, you might need set region of AmazonS3Client, could you please double check?

Result is always null.

What ever i upload, Result is always null. Doesn't throw any exception too..Hard to find where it went wrong. :(

Followed the example exactly.

AwsS3 awsS3 = AwsS3(
awsFolderPath: "your aws folder path",
file: "file is of type File",
fileNameWithExt: "file name",
poolId: "your aws pool id",
region: "your region using enum Regions",
bucketName: "your bucket name to upload");

Have added "in manifest also...

AWS upload is working fine when i tried with other plugins.. But i badly need to get progress of upload.

Doubted param is "awsFolderPath". Is there any specific format for providing it ?

Please help me out...Thanks

Upload failed

D/UploadTask(29312): Failed to upload: 3 due to 1 validation error detected: Value 'AP_SOUTH_1_dAwINAP8R' at 'identityPoolId' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w-]+:[0-9a-f-]+ (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: ValidationException; Request ID: abdc5cdd-582c-4c1a-92d5-c3fc31153186)
E/Transfer(29312): onError: com.amazonaws.AmazonServiceException: 1 validation error detected: Value 'AP_SOUTH_1_dAwINAP8R' at 'identityPoolId' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w-]+:[0-9a-f-]+ (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: ValidationException; Request ID: abdc5cdd-582c-4c1a-92d5-c3fc31153186)
D/Transfer(29312): onStateChanged: "FAILED, 1jpg_1599496218927.jpg

getting this error with the result: null

please help this out

Android build issue

Androidx is not supporting while taking release build in flutter project showing the error
FAILURE: Build failed with an exception.

  • What went wrong:
    Task 'assembleAarRelease' not found in root project 'aws_s3'.

Giving Error of access denied from S3 while uploading a file

Hello Everyone!

While I am uploading a file in S3 using this SDK I am getting an error

Failed to upload: 2 due to Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: ZSQFA0CRMX0HS872)

I am updating the SDK sample project code in these lines

void readEnv() async { poolId = "us-east-2:6d3ba221-d123-4506-824a-659d18ba3b62"; awsFolderPath = "1069/fy202122/rejected"; bucketName = "billupload"; }

I have created a user pool on the user pool role I have added a new policy to access the S3 files.
Screenshot 2021-05-03 at 4 40 02 PM
Screenshot 2021-05-03 at 4 40 15 PM

I am not able to get where was the problem in my app code or AWS setup if you guys have any idea then please help me out.

Thanks in Advance.

Access denied

D/UploadTask(32647): Failed to upload: 6 due to Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: 1AC7FB214CD42697)
E/Transfer(32647): onError: com.amazonaws.services.s3.model.AmazonS3Exception: Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: 1AC7FB214CD42697), S3 Extended Request ID: SXy5z7M9fETAsSSc6GaZsABusvghoixl4Dk8bjI5uJ02xxb4ZVP26WqpCkEI8Ji7cmMyuwXfh68=
D/Transfer(32647): ID:6 bytesCurrent: 157363 bytesTotal: 157363 100%

please help me to solve this

how to set ACL as public

im getting access denied when i trying to get data from s3 which was uploaded using this asw_s3 package? can anyone help to send ACL as public

App Crash

The app is getting crash when I upload resume from ios device

Reply already submitted exception in method channel

I'm using another method channel to show a notification in the android side when the upload begin and finish. When I upload 2 files simultaneously I'm getting an exception like this. I couldn't use the result on my method channel.

java.lang.IllegalStateException: Reply already submitted E/AndroidRuntime(13725): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:148) E/AndroidRuntime(13725): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:234) E/AndroidRuntime(13725): at com.blasanka.s3flutter.aws_s3.AwsS3Plugin$Transfer.onStateChanged(AwsS3Plugin.java:210) E/AndroidRuntime(13725): at com.amazonaws.mobileconnectors.s3.transferutility.TransferStatusUpdater$2.run(TransferStatusUpdater.java:206) E/AndroidRuntime(13725): at android.os.Handler.handleCallback(Handler.java:883) E/AndroidRuntime(13725): at android.os.Handler.dispatchMessage(Handler.java:100) E/AndroidRuntime(13725): at android.os.Looper.loop(Looper.java:228) E/AndroidRuntime(13725): at android.app.ActivityThread.main(ActivityThread.java:7782) E/AndroidRuntime(13725): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(13725): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) E/AndroidRuntime(13725): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:981)

Release App Crash - Reply already submitted

When uploading multiple files, the app crashes leaving following log.
In debug mode it works fine, but in release mode it throws this exception

java.lang.IllegalStateException: Reply already submitted
at io.flutter.embedding.engine.e.b$a.a(DartMessenger.java:4)
at io.flutter.plugin.common.i$a$a.a(MethodChannel.java:1)
at d.a.a.a.a$b.onStateChanged(AwsS3Plugin.java:8)
at com.amazonaws.mobileconnectors.s3.transferutility.TransferStatusUpdater$2.run(TransferStatusUpdater.java:1)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:7861)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:600)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)

Parameter in exception message

On uploading process I got this error:

onError: com.amazonaws.services.cognitoidentity.model.InvalidIdentityPoolConfigurationException: Invalid identity pool configuration. Check assigned IAM roles for this pool. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: InvalidIdentityPoolConfigurationException; Request ID: e35928a5-0370-4ebd-9845-f56d249f282e)

In that message the 'Request ID' does not match to the pool ID that I entered which starts with 'ap-northeast-...'
Does the plug-in use the pool ID input correctly? then what is the request ID in the error message?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.