POST says NETWORK_ERROR when file uri is invalid
See original GitHub issueUsing the code below
const uploadImage = ({url}, uri) => {
const api = apisauce.create({
baseURL: url,
headers: {
'Cache-Control': 'no-cache',
'Content-Type': 'multipart/form-data'
},
timeout: 10000
})
const formData = new FormData()
formData.append('file', {
uri,
type: 'image/jpeg',
name: 'image'
})
api.post('/', formData).then((res) => console.log(res))
Uri was undefined. Response prints out as
{ duration: 33, problem: ‘NETWORK_ERROR’, ok: false, status: null, headers: null, …
Using apisauce version 0.10.0
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
React Native network error in POST request when adding a ...
When I get the file from DocumentPicker I had to add the type of the file because DocumentPicker return an odd type called...
Read more >Axios Post Works but Responds with Network Error #1827
I'm posting to an MVC endpoint that's in the same application so it has the same URL which I suppose can be called...
Read more >Network Error Logging - HTTP - MDN Web Docs
The connection was aborted due to an HTTP protocol error. http.response.invalid. Response is empty, has a content-length mismatch, has improper ...
Read more >Fix JavaScript errors that are reported in the Console
A network error that starts with GET HTTP method followed by a URI. An Uncaught (in promise) TypeError: data.forEach is not a function...
Read more >Introducing the Reporting API, Network Error Logging and ...
We've been super busy at Report URI HQ and we have some awesome new ... which tells the browser where to send the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @skellock thanks for your reply and awesome work with apisauce. Sorry, I should have posted this last night, but I was actually able to fix the issue and it was related o a misconfiguration on my https nodejs server 😦 I used this URL to test if my certificate was correctly installed https://developer.android.com/training/articles/security-ssl.html in case someone has a similar issue. Thanks again. Cheers
Uri was undefined when I got this error. Server didn’t receive the call at all. Content-Type doesn’t affect the problem. Of course I can pretty easily see my mistake, but the error message is misleading.