Fetch Fails on Android, works on IOS
See original GitHub issueReact Native version:
System:
OS: macOS 10.15.1
CPU: (4) x64 Intel(R) Core(TM) i7-6567U CPU @ 3.30GHz
Memory: 47.02 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.11.0 - /usr/local/bin/node
Yarn: 1.10.1 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.7.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5977832
Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.4 => 0.60.4
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
react-native-svg: 6.0.0-rc1
Steps To Reproduce
- Create API with AWS Lambda and API Gateway
- Call the following code:
var headers = {
'Authorization': 'Bearer ${Cognito.signInUserSession.idToken.jwtToken}'
}
console.log("Headers" , headers);
const qs = `{users(username: "aUserName") {username, leagues {name, start, currentTime, ready, creator, totalPlayers, joinedPlayers, creatorInfo {fullName}, draftPicks{user{username, fullName} order,numTickets}}} }`
const URL = 'https://someID.execute-api.us-east-1.amazonaws.com/Prod/graphql?query=${qs}';
return (
fetch(URL, {
method: 'GET',
headers,
})
- Use IOS and Postman, it works fine, on Android I get status 400
Describe what you expected to happen:
I expect the code to work and get 200 response
IOS screenshot that shows it works:
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Fetch Request not working on android, but working on IOS
Hi, any luck? Facing the same issue, the app working fine on IOS but fetch fails in android giving "[TypeError: Network request failed]"...
Read more >Fetch and XHR Request working on Android but not on iOS
On android, the fetch-api completed succesfully, with a correct response from the server. My server does have SSL, and I'm sending the request ......
Read more >Networking
Fetch method will return a Promise that makes it straightforward to write code that works in an asynchronous manner:.
Read more >fetch() - Web APIs | MDN
The promise resolves to the Response object representing the response to your request. A fetch() promise only rejects when a network error is...
Read more >Failed to fetch assets Error - Build issue
This is only happening on iOS build android has built successfully. Vignesh_Rajendiran July 15, 2022, 8:35pm ...
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
I’m getting the same error on RN version 0.61.5 (latest). The exact same call with the same params works on iOS (both device and simulator) and Postman on the web but fails on anything Android (device, emulators with different OS versions). It’s an HTTPS call. It’s also interesting that it works when RN debugger is enabled.
@hramos I can confirm that this is an issue on the latest RN release as well.
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.