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.

[0.54 - iOS] fetch HEAD requests fail with `Invalid response for blob`

See original GitHub issue

Performing a HEAD request with fetch causes an Invalid response for blob error on iOS

Environment

Environment: OS: macOS Sierra 10.12.6 Node: 8.6.0 Yarn: Not Found npm: 5.3.0 Watchman: 4.9.0 Xcode: Xcode 9.1 Build version 9B55 Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed) react: 16.3.0-alpha.1 => 16.3.0-alpha.1 react-native: 0.54.0 => 0.54.0

Expected Behavior

The request should complete without error.

Actual Behavior

The RCTNetworking native module in iOS does not construct an empty blob for HEAD responses like Android does. Instead it returns an empty string as the response. However, whatwg-fetch always sets the responseType to blob for the XMLHttpRequest so the empty string is invalid.

Relevant lines of code: https://github.com/github/fetch/blob/fcc4e1b48cfb5a2b1625fcd6eac06d954b00ccb6/fetch.js#L454 https://github.com/facebook/react-native/blob/6eef7de46ee5c5004854c1cdd5cd83f2a608f622/Libraries/Network/XMLHttpRequest.js#L253-L258

Invalid response for blob: 
handleException @ index.bundle?platform=ios&dev=true&minify=false:13132
handleError @ index.bundle?platform=ios&dev=true&minify=false:12174
reportFatalError @ index.bundle?platform=ios&dev=true&minify=false:783
__guardSafe @ index.bundle?platform=ios&dev=true&minify=false:2360
callFunctionReturnFlushedQueue @ index.bundle?platform=ios&dev=true&minify=false:2165
t @ RNDebuggerWorker.js:1

Steps to Reproduce

1 Clone and run https://github.com/lingokids/FetchError

(I tested on an iPhone 7)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:54
  • Comments:73 (10 by maintainers)

github_iconTop GitHub Comments

14reactions
olivierlesnickicommented, Mar 13, 2018

+1

8reactions
janicduplessiscommented, Mar 27, 2018

cc @grabbou f5207ba9c764f33ef83fa897f6014d67193be0e2 might be worth cherry-picking into 0.54 and 0.55

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - [0.54 - iOS] fetch HEAD requests fail with `Invalid ...
Performing a HEAD request with fetch causes an Invalid response for blob error on iOS. Environment. Environment: OS: macOS Sierra 10.12.6. Node: 8.6.0...
Read more >
"Invalid response for blob" Error When Making XHR Request
Whilst making a request to one of my API endpoints for an iOS application, I came across a very unhelpful error: "Invalid response...
Read more >
Accessory Design Guidelines for Apple Devices
Accessories intended for use with user-supplied cables and/or AC power adapters shall be designed to work with any cables, AC Power Adapters (page...
Read more >
configuration is invalid: http route or redirect is required
Please take a look at this test first. When I try the following code, the result is the same: - error: Uncaught Error:...
Read more >
06c205f49492310fa568d0257ba...
0000-Ticket-49830-Import-fails-if-backend-name-is-default.patch 0001-Ticket-48818-For-a-replica-bindDNGroup-should-be-fet.patch ...
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