GithubHelp home page GithubHelp logo

mybigday / react-native-s3 Goto Github PK

View Code? Open in Web Editor NEW
92.0 6.0 54.0 371 KB

A React Native wrapper for AWS iOS/Android S3 SDK.

License: MIT License

Java 23.43% JavaScript 29.09% Objective-C 43.26% Shell 1.56% Python 2.66%

react-native-s3's Introduction

React Native AWS S3

NPM version Build Status Dependency Status devDependency Status

A React Native wrapper for AWS iOS/Android S3 SDK.

We currently implements TransferUtility, it allow you to upload / download tasks in the background, very suitable for transferring large files, you can freely subscribe / unsubscribe, pause / resume / cancel the task.

See iOS/Android docs for more information.

Known issues

  • Currently reload js will lead TransferUtility not work. (#9)

Installation

$ npm install react-native-s3 --save

Setup

iOS

NOTE Only supported iOS ^8.0.

In XCode, in the project navigator:

  • Right click LibrariesAdd Files to [your project's name], Add node_modules/react-native-s3/ios/RNS3.xcodeproj.
  • Add libRNS3.a to your project's Build PhasesLink Binary With Libraries
  • Add $(SRCROOT)/../node_modules/react-native-s3/ios to Header Search Paths, and mark it as recursive.
  • Add $(SRCROOT)/../node_modules/react-native-s3/ios/Frameworks to your project's Build SettingsFramework Search Paths
  • Add node_modules/react-native-s3/ios/Frameworks/*.framework to your project's GeneralEmbedded Binaries
  • Edit AppDelegate.m of your project
#import "RNS3TransferUtility.h"

......

- (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)())completionHandler {
  [RNS3TransferUtility interceptApplication:application
        handleEventsForBackgroundURLSession:identifier
                          completionHandler:completionHandler];
}
  • [Optional] you can set the credentials in AppDelegate.m
#import "RNS3TransferUtility.h"

......

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [[RNS3TransferUtility nativeCredentialsOptions] setObject:@"eu-west-1" forKey:@"region"];
  [[RNS3TransferUtility nativeCredentialsOptions] setObject:[NSNumber numberWithInt:[RNS3TransferUtility credentialType:@"BASIC"]] forKey:@"type"];
  [[RNS3TransferUtility nativeCredentialsOptions] setObject:@"your_access_key_here" forKey:@"access_key"];
  [[RNS3TransferUtility nativeCredentialsOptions] setObject:@"your_secret_key_here" forKey:@"secret_key"];
  ......
}

Android

  • Edit android/settings.gradle of your project:
...
include ':react-native-s3'
project(':react-native-s3').projectDir = new File(settingsDir, '../node_modules/react-native-s3/android')
  • Edit android/app/build.gradle of your project:
...
dependencies {
    ...
    compile project(':react-native-s3')
}
  • Add package to MainApplication.java
......

import com.mybigday.rns3.*;   // import

public class MainApplication extends Application implements ReactApplication {
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    ......

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
        new RNS3Package(),  // add package
      );
    }
  };

  ......
}

You can use rnpm instead of above steps.

  • Edit android/app/src/main/AndroidManifest.xml of your project:
<service
  android:name="com.amazonaws.mobileconnectors.s3.transferutility.TransferService"
  android:enabled="true" />
  • [Optional] you can set the credentials in MainActivity.java:
import android.os.Bundle;
import com.mybigday.rns3.RNS3TransferUtility;

public class MainActivity extends ReactActivity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    RNS3TransferUtility.nativeCredentialsOptions.put("region", "eu-west-1");
    RNS3TransferUtility.nativeCredentialsOptions.put("type", RNS3TransferUtility.CredentialType.BASIC);
    RNS3TransferUtility.nativeCredentialsOptions.put("access_key", "your_access_key_here");
    RNS3TransferUtility.nativeCredentialsOptions.put("secret_key", "your_secret_key_here");
  }

  ......
}

The nativeCredentialsOptions type

  • BASIC
  • COGNITO

Usage

import { transferUtility } from 'react-native-s3';

See API.md for more information.

Alternatives

  • react-native-aws3 - if you don't need the native library provided background upload/download task features.

License

MIT

react-native-s3's People

Contributors

amanthegreatone avatar athibaud avatar cyyuen avatar damathryx avatar falsecz avatar jhen0409 avatar masahiromorita avatar t-unit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

react-native-s3's Issues

AWSS3TransferUtilityErrorDomain error 2

version - v0.0.24
react-native - 0.38

using transferUtility.setupWithBasic(accessKey, secretKey, sessionKey)
getting this error (only in iOS, android is working fine) on transferUtility.subscribe(id, (err, task)

The operation couldn’t be completed. (com.amazonaws.AWSS3TransferUtilityErrorDomain error 2.

after it fails when upload reaches 100%.
screen shot 2017-02-24 at 10 40 06 pm

What am i missing?

[Android] Compile Error: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

Thanks for the library first, this library is awesome!
But the package of s3 is actually very big
and there's a limitation of methods while building app of android which is 65536
so I encounter this error:

:app:dexDebug Unknown source file : UNEXPECTED TOP-LEVEL EXCEPTION: Unknown source file : com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536 Unknown source file : at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502) Unknown source file : at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277) Unknown source file : at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491) Unknown source file : at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168) Unknown source file : at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) Unknown source file : at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502) Unknown source file : at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334) Unknown source file : at com.android.dx.command.dexer.Main.run(Main.java:277) Unknown source file : at com.android.dx.command.dexer.Main.main(Main.java:245) Unknown source file : at com.android.dx.command.Main.main(Main.java:106)

Just wondering if any one else has the ploblem, and how do you guys solve it?

Getting reports of Attempt to invoke virtual method 'int com.mybigday.rns3.RNS3TransferUtility$CredentialType.ordinal()' on a null object reference

This is only happening on some Android users.

Stack trace:

com.mybigday.rns3.RNS3TransferUtility.setup RNS3TransferUtility.java:142
com.mybigday.rns3.RNS3TransferUtility.setupWithNative RNS3TransferUtility.java:199
java.lang.reflect.Method.invoke Method.java
com.facebook.react.bridge.JavaMethodWrapper.invoke JavaMethodWrapper.java:363
com.facebook.react.bridge.JavaModuleWrapper.invoke JavaModuleWrapper.java:166
com.facebook.react.bridge.queue.NativeRunnable.run NativeRunnable.java
android.os.Handler.handleCallback Handler.java:739
android.os.Handler.dispatchMessage Handler.java:95
com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage         
MessageQueueThreadHandler.java:31
android.os.Looper.loop Looper.java:148
com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run         
MessageQueueThreadImpl.java:194
java.lang.Thread.run Thread.java:818

Here is the full report off one of the crashed devices:

app-0e2665c4-6dc0-44f6-9cf5-9bf9be927738-id-6e43f461-6049-4353-a5b2-227df09dcfdd.zip

Any idea on where I can start to fix this?

Can't upload m4a file to bucket.

Hi there,

Very nice lib! I'm trying to upload a m4a file to my bucket and everything seems to work fine (no exceptions or errors).

I've subscribed to the task and it I get completed back from AWS but I can't see the file in my bucket.

Is there something I need to do specifically in order to upload media files?

screen shot 2016-06-08 at 10 58 49

Progress Not Updating!

Hi,

So during the upload I subscribe to the event and I get this results:
screen shot 2016-03-13 at 3 12 48 pm
Should the bytes be different than 0 during in_progress?

Thank You!

Pausing and resuming an upload causes the task.bytes to be wrong

Hi guys I have noticed that calling pause then resume on an upload sets the task.bytes to 0 even tough the task.totalBytes stays the same. I was expecting it to start where it previously left. I am displaying a progressbar and it gives the impression that the resume did not work.

I know for a fact that the upload resumes correctly since as soon as the task.bytes roughtly equals to the remaining bytes I get a call with task.state === 'completed'.

I have tested it in Android only since I do not have access to an Apple machine at the moment.

I have tried to write a scenario using the example project but I couldn't make it run.

Thank you

Uploading a file with public-read

Hi, I'm trying to upload some files on my s3 with this package. It's working well but I'm having an issue because I've got an "Access denied" when I want to access to the file. I'd like it to be public-read and I'm doing this

      const uploadOptions = {
        'bucket': config.aws.bucket,
        'key': `${config.aws.identityPoolId}/${uuid.v1().slice(0, 7)}.jpeg`,
        'file': file,
        'meta': {
          'Content-Type': 'image/jpeg',
          'x-amz-acl': 'public-read'
        }
      }

      const task = await transferUtility.upload(uploadOptions)

when I'm uploading a file but I still have the 'Access denied', even if with the public-read acl.

Any help on this please?

Invalid file:/data/data/com.s3samples/files

hai, when i try to run your example in react-native-s3, i got an error as shown in the below image,could you please tell me that how to overcome it,

-npm install

  • to run in android: react-native run-android
    After that in emulator when click on New Upload i got an error like below

screen shot 2016-03-22 at 12 38 35 pm

please tell me that how to resolve it

Failed to push to apple store

We tried to upload to apple store, then get the following errors:

iTunes Store Operation Failed
description length:1020218

iTunes Store Operation Failed
ERROR ITMS-90087: "Unsupported Architectures. The executable for ****.app/Frameworks/AWSCognito.framework contains unsupported architectures '[x86_64, i386]'."

iTunes Store Operation Failed
ERROR ITMS-90087: "Unsupported Architectures. The executable for ****.app/Frameworks/AWSCore.framework contains unsupported architectures '[x86_64, i386]'."

iTunes Store Operation Failed
ERROR ITMS-90087: "Unsupported Architectures. The executable for ****.app/Frameworks/AWSS3.framework contains unsupported architectures '[x86_64, i386]'."

iTunes Store Operation Failed
ERROR ITMS-90635: "Invalid Mach-O Format. The Mach-O in bundle "****.app/Frameworks/AWSCognito.framework" isn’t consistent with the Mach-O in the main bundle. The main bundle Mach-O contains armv7(bitcode) and arm64(bitcode), while the nested bundle Mach-O contains X86_64ALL(machine code). Verify that all of the targets for a platform have a consistent value for the ENABLE_BITCODE build setting."

iTunes Store Operation Failed
ERROR ITMS-90635: "Invalid Mach-O Format. The Mach-O in bundle "****.app/Frameworks/AWSCore.framework" isn’t consistent with the Mach-O in the main bundle. The main bundle Mach-O contains armv7(bitcode) and arm64(bitcode), while the nested bundle Mach-O contains X86_64ALL(machine code). Verify that all of the targets for a platform have a consistent value for the ENABLE_BITCODE build setting."

iTunes Store Operation Failed
ERROR ITMS-90635: "Invalid Mach-O Format. The Mach-O in bundle "****.app/Frameworks/AWSS3.framework" isn’t consistent with the Mach-O in the main bundle. The main bundle Mach-O contains armv7(bitcode) and arm64(bitcode), while the nested bundle Mach-O contains X86_64ALL(machine code). Verify that all of the targets for a platform have a consistent value for the ENABLE_BITCODE build setting."

iTunes Store Operation Failed
ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at '****.app/Frameworks/AWSCognito.framework/AWSCognito' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."

iTunes Store Operation Failed
ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at '****.app/Frameworks/AWSCore.framework/AWSCore' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."

iTunes Store Operation Failed
ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at '****.app/Frameworks/AWSS3.framework/AWSS3' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."

iTunes Store Operation Failed
ERROR ITMS-90125: "The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's linker."

iTunes Store Operation Failed
WARNING ITMS-90704: "Missing App Store Icon. iOS Apps must include a 1024x1024px App Store Icon in PNG format. Without providing the icon in the Asset Catalog or via iTunes Connect, apps cannot be submitted for App Review or Beta App Review. Refer to https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/app-icon/ for more information."

iTunes Store Operation Failed
WARNING ITMS-90080: "The executable 'Payload/****.app/Frameworks/AWSCognito.framework' is not a Position Independent Executable. Please ensure that your build settings are configured to create PIE executables. For more information refer to Technical Q&A QA1788 - Building a Position Independent Executable in the iOS Developer Library."

iTunes Store Operation Failed
WARNING ITMS-90080: "The executable 'Payload/****.app/Frameworks/AWSCore.framework' is not a Position Independent Executable. Please ensure that your build settings are configured to create PIE executables. For more information refer to Technical Q&A QA1788 - Building a Position Independent Executable in the iOS Developer Library."

iTunes Store Operation Failed
WARNING ITMS-90080: "The executable 'Payload/****.app/Frameworks/AWSS3.framework' is not a Position Independent Executable. Please ensure that your build settings are configured to create PIE executables. For more information refer to Technical Q&A QA1788 - Building a Position Independent Executable in the iOS Developer Library."

[Android] uri with content://com.... give `Invalid file`-error

Im currently using this library in conjuction with react-native-image-picker. When choosing a video on android phones, the uri given is of the format content://com.google.android.apps.photos.contentprovider/-1/2/content%3A%2F%2Fmedia%2Fexternal%2Ffile%2F1061/ORIGINAL/NONE/1578050655. react-native-s3 then throws an error of Invalid file.
Using react-native-aws3 doesnt give this error and it uploads correctly. Im migrating over to this library as it has backgroundupload! So I would love to know how to solve this problem.

Are you planning on adding iOS support for deleteRecord?

Hi guys today I am working on the iOS implementation of a new app we are building using react-native. I just realised that transferUtility.deleteRecord throws a "Not Implemented" error. After double checking the documentation I can see that there is an (Android) label next to deleteRecord. I was wondering if you are planning on implementing it in iOS as well and when.

Thanks

Failed upload when uploading reaches to 100% [iOS only]

Version: 0.0.22
RN Version: 0.38.0
React version: 15.4.1
I'm having this issue when uploading in iOS. when the uploading progress reaches to 100% it fails.
my log looks like this:
screen shot 2017-02-23 at 12 03 30 pm

android is perfectly fine though and I have the same component for both platforms

UPDATE:
Additional note:

  • Upon reaching 100% the tasks also disappear from getTasks.
  • below is a task object, bytes and totalBytes are equal but status is failed
    screen shot 2017-01-19 at 11 10 29 pm

UPDATE:
I am using transferUtility.setupWithBasic and passing accessKey, secretKey, and sessionKey.
Promise returns true also.

Build failing during linking on "RNS3TransferUtility.h"

While setting up react-native-s3, I followed all the steps under Setup -> iOS. When I went to build, the linker failed on the following line in AppDelegate.m:

#import "RNS3TransferUtility.h"

I added node_modules/react-native-s3/ios/RNS3/RNS3TransferUtility.h to Build Phases -> Compile Sourcesand then my project compiled. However, given all the steps in the setup instructions in the readme, I'm not sure this step is / should be required? Is there something else I missed?

Exception when uploading in ios

Hi,

getting an exception when trying to upload in ios. The same code works perfectly on android device.

screen shot 2017-03-04 at 12 07 23 pm


const subscribeWithUpdateState = (id, typeKey, attachment) => {
  console.log("subscribeWithUpdateState", "id", id, "typeKey", typeKey);

  transferUtility.subscribe(id, (err, task) => {
    if(err){
      task.errMessage = err;
    }
    else{
      if(task.state === "completed"){
        console.log("task uploaded", task, "attachment", attachment);

        //update the offline attachment for successful upload
        updateAttachmentUploaded(attachment);

        //dispatch action to update the attachment in the store

      }//end if upload task completed
    }
  });

};//end of subscribeWithUpdateState

export function uploadAttachment(attachment) {

  //initialize s3 transferUtility
  transferUtility.setupWithCognito(S3Options)
    .then( (result) => {
      console.log("s3 setup result", result);

      //compress the file
      let imagePath = `${dirPicutures}/${attachment.s3_key}`;
      let compressedImagePath = `${dirPicuturesCompressed}/${attachment.s3_key}`;

      compressImage(imagePath, compressedImagePath)
      .then( (imageResized) => {
        console.log("imageResized boolean", imageResized);

        //upload to s3
        const contentType = "image/jpg";

        transferUtility.upload({
          bucket: BucketName,
          key: attachment.s3_key,
          file: compressedImagePath,
          meta: { "Content-Type": contentType }
        }).then( (task) =>  {
          console.log("task uploding:", task);

          //subscribe to the s3 upload status and pass in the attachment to update once upload successful
          subscribeWithUpdateState(task.id, "uploadTasks", attachment);

        })//end promise upload to s3
        .catch( (error) => console.log("upload error:", error) );

      })//end promise successful for compressImage
      .catch( (error) => console.log("imageResized error", error) );

    })//end promise successful s3 cognito setup
    .catch( (error) => console.log("s3 setup error", error) );

}//end of uploadAttachment

iPhone 6 simulator / iphone 4 device
RN 0.40.0
react-native-s3 0.0.24

Roadmap

iOS

  • Move download-ios script to prepublish
  • TransferManager
  • Bucket Control
  • CredentialsProvider
    • STS

Android

  • TransferManager (Deprecated)
  • Bucket Control
  • CredentialsProvider
    • STS

always 0%

Hi,

If a upload was stopped in the middle because of closing the app or crash of the app. When we try to upload any file again, it rendered in_progress event with 0 bytes a few times and then stopped doing anything. This is on Android and had been reproduce-able every time.

Please help take a look.

Thanks
Gary

Cannot cancel a task on iOS

var tasks = await transferUtility.getTasks("upload", false);
tasks.forEach(()=>{ transferUtility.cancel(task.id); });

And here is an error log:

2018-03-02 19:58:26.720984-0800 vqa[2254:993877] -[NSNull objectForKey:]: unrecognized selector sent to instance 0x1b2bca650
2018-03-02 19:58:26.724078-0800 vqa[2254:993877] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull objectForKey:]: unrecognized selector sent to instance 0x1b2bca650'
*** First throw call stack:
(0x181af2364 0x180d38528 0x181aff828 0x181af7d10 0x1819dcecc 0x10422f57c 0x104230174 0x1054587e8 0x10545f65c 0x10545fbac 0x1054583e4 0x105457f24 0x10545a6a8 0x1054589f4 0x1054587e8 0x10545f65c 0x10545fbac 0x1054583e4 0x105457f24 0x10545a6a8 0x104ffa33c 0x1822319d8 0x182133598 0x1824c9ba0 0x182409894 0x1823f94c4 0x10595128c 0x10595d9e4 0x10595128c 0x10595d9e4 0x10595d8a4 0x1824cb878 0x10595128c 0x10595e678 0x10595cf08 0x1059629d0 0x1059626f4 0x18171706c 0x181716b6c)
libc++abi.dylib: terminating with uncaught exception of type NSException

Task doesn't complete on Android

Thank you for your great repo.
On iOS, your code works perfectly, but on Android, it doesn't.

In the following code, subscribed callback function has never called on Android.
How can I solve this?

React Native: 0.45.1

import { transferUtility } from 'react-native-s3';

export default function s3upload(credentials, video_id, s3_key, file, onprogress) {
  transferUtility.setupWithBasic({
    region: 'ap-northeast-1',
    access_key: credentials.access_key_id,
    secret_key: credentials.secret_access_key,
    session_token: credentials.session_token,
  })

  return new Promise((resolve, reject)=> {
    transferUtility.upload({
      bucket: credentials.bucket_name,
      key: `${video_id}/${s3_key}`,
      meta: {
        'Content-Type': file.type,
      },
      file: file.uri
    }).then((task)=> {
      transferUtility.subscribe(task.id, (err, newTask)=> {
      // => will not be called this callback on Android
        if (newTask.state == 'completed') {
          transferUtility.unsubscribe(newTask.id)
          resolve(video_id)
        } else if (newTask.state == 'canceled' || newTask.state == 'failed' || err) {
          transferUtility.unsubscribe(newTask.id)
          reject('error:s3upload')
        }
      })
    }).catch((err)=> {
      reject('error:s3upload')
    })
  })
}

Add HOC for subscribe TransferUtility tasks

It looks like:

import React, { Component } from 'react'
import { subscribeTasks } from 'react-native-s3'

const type = 'all' // download, upload, all
const idAsKey = true
const mapTasksToProps = ({ uploadTasks, downloadTasks, methods }) => ({
  uploadTasks,
  downloadTasks,
  upload: methods.upload,
  download: methods.download,
  refresh: methods.refresh,
})
const options = { withRef: true }

const Demo = ({ uploadTasks, downloadTasks }) => {
  ......
}
export default subscribeTasks(
  type,
  idAsKey,
  mapTasksToProps,
  options
)(Demo)

Or with decorators:

@subscribeTasks(
  type,
  idAsKey,
  mapTasksToProps,
  options
)
export default class Demo extends Component {
  render() {
    const { uploadTasks, downloadTasks } = this.props
    return (
      ......
    )
  }
}

Feature request: user provided metadata "x-amz-meta-"

Hi, thanks for this great module.
It would be cool to have the possibility to add custom meta information,
AWS provides the prefix 'x-amz-meta-' for this propose https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#object-metadata

It seems that the aws-sdk-ios has the possibility to add metada by calling the AWSS3TransferUtilityExpression method [setValue:forRequestParam]](http://docs.aws.amazon.com/AWSiOSSDK/latest/Classes/AWSS3TransferUtilityExpression.html#//api/name/setValue:forRequestParameter:)
So in Javascript the call would be like

  const task = await transferUtility.upload({
          bucket: 'ghinwa-songs',
          key: 'uploads/foo.mp3',
          file: 'tmp/123abc.mp3',
          meta: {
            contentType: 'audio/mpeg',
            'x-amz-meta-my-custom-data': 'here'
          }
        })

I don't have much experience with Objective-c but I see that in RNS3TransferUtility.m line 224
There should be a way to get every key of the meta object that starts by 'x-amz-meta-' and for call the setValue method of expression, right ?
Are you interested in adding this change ? are my assumptions correct ?
Thanks.

[question] stuck at waiting

all of my uploads are stuck on waiting.
I am using setupWithCognito and it returns true but when I try to upload its stuck in waiting when I call getTask.
So I'd like to know what are the probable cause of this?

constant state of WAITING on IOS

Hello!

Thanks for the great library. Im currently having some problems on IOS where the state never switches from waiting to in_progress during an upload.

My use case is the following:
A user may update his/hers profile picture. This is sent to aws3 and stored there. This image is taken by an imagepicker and could be either from the camera directly or from the camera roll.

The problem Im having is that updating it once works perfectly well! It's when you try to update it twice and more that the state never shifts from waiting to in_progess.

One thing I noticed is that it works perfectly well on Android. Its only IOS that it doesnt work for. Any ideas?

Support multiple TransferUtility instances

Just like:

import { TransferUtility } from 'react-native-s3';

const defaultTransfer = new TransferUtility();  // default instance
const transfer = new TransferUtility('transfer_name_here');

setupWithCognito exception on ios

Hi,

I am getting this exception on ios only (working fine on android)
screen shot 2017-06-02 at 5 09 49 am

RN 0.44.1
react-native-s3 0.26.0
iphone 6 simulator and iphone 4s device -> error
android device -> ok

Please help to troubleshoot.

cannot run more than 4 tasks together

i have 6 books to download
i can subscribe to the first 4 successfully
when i click on the fifth it gets stuck in waiting state
when i click on the sixth, the fifth gets cancelled and the sixth enters the waiting state

any idea why this is happening ?

Attempting to call `getTask` throws exception

Every time I try to call getTask with the task id returned from upload, I see the following error:

screen shot 2016-03-16 at 5 02 14 pm

However, the uploading does work. I just can't seem to use getTask. I did notice that if I put in a long timeout (1500ms) between when the promise from upload resolves and calling getTask, it does not throw that error. But I get null back.

getTasks seems to work, but it always returns an empty array.

Could not invoke RNS3TransferUtility.setupWithNative

I am having this issue while running following piece of code:

const options = {
region: 'my_region',
access_key: 'myAccessKey',
secret_key: 'MySecretKey',
remember_last_instance: true
}
export const startTransfer = async () => {
try {
const status = await transferUtility.setupWithNative()
console.log(status)
} catch (error) {
console.log(error)
}
}

------------If anyone has implemented help will be appreciated a lot. I am stuck in uploading to s3 in background with react native. If you can suggest any alternatives please let me know.

Build error ios

Getting this error.

ld: framework not found AWSCore for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

NotAuthorizedException

I'm getting

UploadTask: Failed to upload: 11 due to Unauthenticated access is not supported for this identity pool. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: NotAuthorizedException;

error in logcat.
setupWithCognito return true. What am I missing?
I'm new to AWS so I am not sure where to look.

[iOS] Doesnt run js in subscribe in the background?

#I've noticed a problem with javascript located in the transferUtility.subscribe doesnt run while in the background. My current code is the following:

        transferUtility.subscribe(id, (err: Error, task: TaskObject) => {

            // Nothing in here will be run when in the background

            if (err) {this._handleError(err); return;}

            this._clearAndSetUploadTimeout();
            const {bytes, totalBytes} = task;
            const progress = Math.floor(bytes / totalBytes * 100);
            this._updateProgress(progress);
            this._updateComponentStateOnAWS3Task(task, {lat, lng});
        });

Is this a bug or a limitation of the library or a restriction on the phones themselver?

stuck at waiting (android)

transferUtility.setupWithBasic returns true but when I try to upload
all the uploads are in waiting state.
in adbLogcat:

ActivityManager: Unable to start service Intent { act=add_transfer cmp=com.project.main/com.amazonaws.mobileconnectors.s3.transferutility.TransferService (has extras) } U=0: not found

What are the probable cause of this?

TypeError: Cannot read property 'Bucket' of undefined - but object is correct

Hi - I am not having success due to an error: "TypeError: Cannot read property 'Bucket' of undefined"

Below is my execution of the transfer utility

const sendToS3WithTransferUtil = (video, box, user) => {
  const config = {
    region: configs.AWS.region,
    access_key: configs.AWS.accessKeyId,
    secret_key: configs.AWS.secretAccessKey,
  };
  const movName = movieName(video);

  return transferUtility.setupWithBasic(config).then((ready) => {
    const options = {
      file: video.uri,
      bucket: configs.AWS.bucketInput,
      key: `uploads/${box.doc.ref.id}/${user.doc.ref.id}/${movName}`,
    };
    console.log(ready, 'transferUtility ready for s3; upload options -> ', options);

    return transferUtility.upload(options);
  });
};

  1. i can verify config going into the method reads as i expect and promise returns true.
  2. i can verify options going into the method reads as i expect
{bucket:'my.bucket.name',file:'longpathtofile',key:'path/to/file/in/bucket.mp4'}

have i done this incorrectly?

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.