I am working on an app that has web and mobile ui components. We are using evaporate.js to call an endpoint that will return a pre-signed url for chunk uploading to aws buckets. This concept works when used from react and it sends the to_sign
querystring parameter to create the pre-signed
url. For some reason, when this code is run from react native the to_sign
query string value is not getting passed to the endpoint. What could possibly block the to_sign
parameter from getting passed from evaporate, this same code is working for react app? Here is the code we are calling from react native:
const uploader = Evaporate.create({
signerUrl: config.SIGNER_URL,
aws_key: config.AWS_KEY,
bucket: config.BUCKET,
awsRegion: config.AWS_REGION,
cloudfront: true,
xhrWithCredentials: true,
computeContentMd5: true,
cryptoMd5Method: (d) => btoa(sparkMD5.ArrayBuffer.hash(d, true)),
cryptoHexEncodedHash256: sha256,
});
const uploadFile = (file, cb) => {
setLoading(true);
setUploadingError("");
let newName = uuidv4();
let extension = file.name.split(".");
uploader
.then((evaporate) => {
evaporate
.add({
file,
name: newName + "." + extension[2],
})
.then((res, err) => {
if (res) {
cb(res);
setLoading(false);
} else if (err) {
setUploadingError("Something went wrong");
setLoading(false);
}
});
})
.catch((err) => {
setUploadingError("Something went wrong");
setLoading(false);
});
};
Not sure if this is a reach, but the mobile version does not supply a url for CORS as opposed to the url set on the CORS s3 admin screen, so could this possibly be a CORS issue?