Complete
over 2 years ago

WERETECH-8848

Cannot Reproduce

makeWebRequest: bad request on some devices

Some devices got a bad request on next makeWebRequest: 

Communications.makeWebRequest("https://www.googleapis.com/calendar/v3/calendars/[email protected]/events",
{timeMin=>2020-4-30T12:19:00+02:00, timeMax=>2020-5-1T12:19:00+02:00},
{:method=>Communications.HTTP_REQUEST_METHOD_GET, :headers=>{ "Authorization"=>"Bearer "+"ya29…valid-oauth-token…
OpxLk" }}, method(:onEvents));

  1. in simulator it works fine
  2. in majority of devices it works fine
  3. the oauth token is valid: the login was confirmed and another request was successful
  4. Error 400: Bad Request on some devices: e.g.  iPhone X, iOS 13.4.1, Garmin Connect: 4.30
    1. same parameters work on https://developers.google.com/calendar/v3/reference/events/list
    2. the user even tested it works for his account in the simulator, but not in the device through his phone

Testing: 

  • by previous testing I realised in another request the device translated "showDeleted"=>false  to "showDeleted"=>0 and that was not accepted by Google on some devices while worked fine on most of them. So I fixed that one. 
  • but in the request above all the parameters are strings, so I don't see anything that can go wrong. 
  • from debugging couple of devices, I am almost sure the problem is caused inside the makeWebRequest. But I don't know what can go wrong. The debug data just looks good yet it replies with the Bad Request. 

What can be wrong there? 

The only idea I have is that it is something phone/app specific inside the makeWebRequest itself. 

Source, app.

Parents
  • No. WERETECH-8848 has been assigned.

    It looks like you've run into several different issues...

    1) boolean true/false values are converted to 1/0 (previously this had happened on GCM/Android and was fixed in 2017)
    2) a 204 return code is being misinterpreted as a failure

    I'm almost certain that we will find some code that is checking the HTTP response code is 200 and reporting an error if it is not.

Comment
  • No. WERETECH-8848 has been assigned.

    It looks like you've run into several different issues...

    1) boolean true/false values are converted to 1/0 (previously this had happened on GCM/Android and was fixed in 2017)
    2) a 204 return code is being misinterpreted as a failure

    I'm almost certain that we will find some code that is checking the HTTP response code is 200 and reporting an error if it is not.

Children
  • Hello, any news in the ticket? 

    The reports are piling up. The new one actually reported a Google calendar API error: "deleted_client" that is returned when called with unknown parameter of client_id. That absolutely makes no sense, because the client_id is shared for all users using the watchface. So it would have to work for everybody or nobody. No way it would work only for some. 

    It seems there's a problem not just with the responses but even with request parameters. But only on some devices. Majority of the devices still works reliably. 

    Any possibility of fixing this soon? 

    Thank you for your consideration.