Please provide the following:
- SDK Version: 35
- Platforms(Android/iOS/web/all): ios
I use ‘fetch’ to connect to the backend of my service via https. It works very well in simulator, but when I release it in production only 1 of 10 requests arrive to my backend (I have nginx before my backend and I read access.logs so I am totally confident in my backend).
I use fetch this way:
async _apiGetJson(handler) {
responseJson = {}
url = this.api_url + handler
headers = {}
try {
headers = {
'Content-Type': 'application/json',
'X-Api-Key': this.api_key,
'X-User-Id': this.user_id,
'X-Language': this.language,
'X-User-Agent': this._userAgent(),
}
let response = await fetch(url, {
method: 'GET',
headers: headers,
});
responseBody = await response.text();
console.log('Backend.js : http GET request:', url, 'response code:', response.status, 'body:', responseBody);
if (response.status != 200) {
throw(new Error(responseBody));
}
responseJson = JSON.parse(responseBody);
} catch (error) {
console.error('ERROR: Backend.js: fetching api ' + url + ', headers:' + headers + ' : ' + error);
throw(error);
}
return responseJson
}
So why the ios production application connects to my backend only 1 of 10 times?