Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 28476

Axios post on Android device give me Network Error

$
0
0

I have an axios call to a presigned url in s3 for upload, this work well in IOS but trow "Netowork Error" in android.

The code is pretty simple but without any other information (the response is empty) I do not kwno how to solve this.

            axios.post(presignedPostData.url, formData, config)
                .then(function (response) { 
                })
                .catch(function (err) { console.log('S3err',err, err.response) })

I use react-native with expo, the axios call work in ios and also in the web version.


UPDATE

The problem seems relative to formdata, if for example I remove the formdata obviously my post not work but the error (missing pre-conditions...) and the status (412) code are ok, but with formdata I've not error description nor status code..


UPDATE 2: the formdata, autogenerated from s3.createPresignedPost (they work in ios and web)

{"_parts":[["Content-Type","video/mp4"],["key","src-058ef4d0-0d49-11ea-8478-3b47e74a5983.mp4"],["acl","public-read"],["bucket","my.bucket"],["X-Amz-Algorithm","AWS4-HMAC-SHA256"],["X-Amz-Credential","mycredentials"],["Policy","mypolicy"],["X-Amz-Signature","mysignature"],["file",{"cancelled":false,"width":1280,"type":"video","uri":"file:///data/user/0/host.exp.exponent/cache/ExperienceData/%myapp%252Fmyapp/ImagePicker/8d68fafa-5c47-4436-9323-dc0d8702dc5d.mp4","rotation":90,"height":720,"duration":1280}]]}

Also tested with fetch (in place of axios), same problem.


UPDATE 3

If I use FyleSystem

`import * as FileSystem from 'expo-file-system';

//mediaArray['file'] = file;
mediaArray['fileALT'] = FileSystem.cacheDirectory+name

I'm able to du the upload with code 204 but the file uploaded isn't right. Maybe there is a permission problem on imagepicker. Still not working the process but with this new informations maybe someone can have an idea.


Viewing all articles
Browse latest Browse all 28476

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>