benjreinhart / react-native-aws3

Pure JavaScript React Native library for uploading to AWS S3
MIT License
398 stars 151 forks source link

Getting No route to host exception #79

Closed brajeshsipl closed 5 years ago

brajeshsipl commented 5 years ago

I am using this package to directly upload image to AWS S3 below is my
code to upload image

const file = {
  uri: 'file:///storage/emulated/0/DCIM/image-cd07934e-565d-4f57-9776-0e5fb42b9c9a.jpg',
  name: "image.jpg",
  type: "image/jpg"
}
        const options = {
            bucket: "BUCKET-NAME",
            region: "REGION",
            accessKey: "ACCESS-KEY",
            secretKey: "SECRET-KEY",
            successActionStatus: 201
        }

        RNS3.put(file, options).then(response => {
            console.log(response);
            if (response.status !== 201)
                throw new Error("Failed to upload image to S3");
            console.log(response.body);
        }).catch((error) => { console.log(error) });

Version :- "react": "16.3.1", "react-native": "^0.55.0", "react-native-aws3": "0.0.8",

Getting this below error:-

{ status: 0, text: 'No route to host', headers: {} }

amanthegreatone commented 5 years ago

try adding awsUrl: `s3.${REGION}.amazonaws.com` and see

brajeshsipl commented 5 years ago

i am closing this issue as this issue was due to our ISP server.