04-09-2019 23:30
04-09-2019 23:30
Hi, I am facing an issue with POST request. It doesn't seem to be firing at all - not getting any errors either, so it is a blackbox to debug.
I believe this may be an iOS device related issue. I tested my code in companion and on an Android device and it works seamlessly.
I've made sure internet permissions are configured in package.json and the request is to an HTTPS server.
Any idea what the issue could be? Code snippet here:
export async function uploadS3(file, signedRequest) {
let headers = { "Content-Type": 'text/plain'};
console.log("uploadS3", signedRequest);
const payload = await file.text();
console.log("getting here?");
return fetch(signedRequest, {method: "PUT", headers: headers, body: new File([payload], file.name)}).then(response => {
console.log("uploadS3 response", response.ok, response);
if (response.ok) {
return true
}
console.log("response, failed upload", JSON.stringify(response))
return Promise.reject(Error('Upload failed, error ' + response.status));
}).catch(error => {
console.log(error, error.message);
return Promise.reject(Error(error.message))
});
}