question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

POST says NETWORK_ERROR when file uri is invalid

See original GitHub issue

Using 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:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
chiechelskicommented, Jun 14, 2017

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

0reactions
iorenacommented, Jun 19, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found