"Missing request token for request" while uploading image using s3

Viewed 1056

I got this error after upgrading react-native to 0.63.0, it happens only in ios while uploading an image using s3 note: it works perfectly on android

here it's my function that pick the image using react-native-image-crop-picker and upload it using react-native-aws3

const PickImage = () => {
    setImageLoader(true)
    ImagePicker.openPicker({
        width: 300,
        height: 400,
        loadingLabelText: 'loading',
    })
    .then(async response => {
        const file = {
            uri: response.path,
            name: `${userId}/${response.path}`,
            type: response.mime,
        }
        const options = {
            keyPrefix: 's3images/upload/',
            bucket: 'quix-static',
            region: 'eu-west-1',
            accessKey: 'AKIAIN6746BLTCD6D72A',
            secretKey: 'xxx',
            successActionStatus: 201,
        }
        RNS3.put(file, options).then(res => {
            if (res.status !== 201) {
                setImageLoader(false)
                disableSubmitButton(false)
                throw new Error('Failed to upload image to S3!')
            } else {
                setImage(get(res, 'body.postResponse.location'))
                disableSubmitButton(false)
                setImageLoader(false)
                setUploaded(true)
            }
        })
    })
    .catch(() => {
        setImageLoader(false)
    })
}
0 Answers
Related