benjreinhart / react-native-aws3

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

Android upload with a `HOST ... not verified` #63

Closed jiyarong closed 6 years ago

jiyarong commented 6 years ago

"Hostname cn.wfl-ischool.app.oralv1.s3.cn-north-1.amazonaws.com.cn not verified: certificate: sha256/7ZXQS/UDzRMV2KyFbtuVg0QKioBlbEeVNh2VJoGwHzI= DN: CN=.s3.cn-north-1.amazonaws.com.cn,O=Amazon Connect Technology Services (Beijing) Co.\, Ltd.,L=Huairou District,ST=Beijing,C=CN subjectAltNames: [.s3.cn-north-1.amazonaws.com.cn, s3.cn-north-1.amazonaws.com.cn]"

And this is my code

export const Aws3UploadApi = (file) => {
    return new Promise((resolve, reject) => {
        RNS3.put(file, AwsOptions).then(response => {
            console.log('raw response', response)
            if (response.status !== 201)
                {return reject()}
            else {
                return resolve(response)
            }    

        }).catch((err) => {console.log('has err', err)})
    })

}

         let date = new Date()
        let file_name = `${date.getTime()}.jpeg`
        let file = {
            uri: filePath,
            name: file_name,
            type: 'image/jpeg'
        }
        Aws3UploadApi(file).then((response) => {
            console.log('resp', response)
        }).catch((err) => {console.log('has error', err)})
enrtama commented 6 years ago

same error here!

enrtama commented 6 years ago

@jiyarong solved! I just removed all the dots (".") from my bucket name (replaced it with "-" instead)