Search code examples
react-nativeamazon-s3aws-amplifyaws-amplify-sdk-js

How to use S3 on a react-native project without AWS Amplify


For a multitude of reasons, mostly ease of use and internally broken imports, I don't want to add AWS amplify to my current react-native project. Is there any way I can directly read objects from S3 without AWS amplify and all of the complication that comes with setting that up in an existing project?

Thanks

I've tried using the @aws-sdk/client-s3 but that imports packages from the NodeJS standard library (which are not available in react, such as 'stream'). I've tried to setup AWS amplify but it adds far too much complexity for something as simple as reading an Object from an S3 bucket

EDIT: I've had a working react native application deployed on the app store for months now, but suddenly the s3 sdk started importing the standard NodeJS library (stream). My application doesn't require any of the IAM roles, buckets, and "amplify backends" that amplify creates for me. In the interest of keeping my app's code as simple and straightforward as possible, I don't want to add a whole new managed workflow for something that I don't use


Solution

  • Fixed!! Quite annoyed at how simple this was:

    I restored my git branch to the last working point, deleted the node_modules, install aws-sdk (not @aws-sdk/client-s3 like I had before), and rebuilt my development client with expo, and voila!