cubehouse / themeparks

Unofficial API for accessing ride wait times and schedules for Disneyland, Disney World, Universal Studios, and many more parks
MIT License
542 stars 125 forks source link

TokyoDisneyResort not working #179

Closed jeanmatthieud closed 5 years ago

jeanmatthieud commented 5 years ago

Park TokyoDisneyResortDisneySea and TokyoDisneyResortMagicKingdom

Context

Describe the bug Working fine with the OnlineTest, but I get the following error when using it in my node software :

400: {
  "errors": [
    {
      "code": "error.invalidVersion"
    }
  ]
}
jeanmatthieud commented 5 years ago

TestOnline is working fine on my dev machine and on my server.

cubehouse commented 5 years ago

MK working for me in my test suite (using 5.1.1 from npm), though DisneySea is giving me a weird error:

"ERROR FOR TokyoDisneyResortDisneySea: TypeError: Cannot read property 'split' of undefined"

Guessing there is a network hiccup without a good error catch.

Maybe just need a version bump? We try and fetch the version from the Google Play store, but it might be that it's caching for too long, or if we detect an invalid version maybe we should force a Google Play refresh to get the latest version?

jeanmatthieud commented 5 years ago

I enabled some logs on my server, and got the following error:

1|ChronoPass API  | THEMEPARKS 3912: Network request failed attempt 1/3 for URL https://api-portal.tokyodisneyresort.jp/rest/v1/parks/calendars?since=2019-06-14
1|ChronoPass API  | THEMEPARKS 3912: 400: {
1|ChronoPass API  |   "errors": [
1|ChronoPass API  |     {
1|ChronoPass API  |       "code": "error.invalidVersion"
1|ChronoPass API  |     }
1|ChronoPass API  |   ]
1|ChronoPass API  | }

and

1|ChronoPass API  | THEMEPARKS 3912: Calling GET:https://api-portal.tokyodisneyresort.jp/rest/v1/facilities/conditions
1|ChronoPass API  | THEMEPARKS 3912: Network request failed attempt 3/3 for URL https://api-portal.tokyodisneyresort.jp/rest/v1/facilities/conditions
1|ChronoPass API  | THEMEPARKS 3912: 400: {
1|ChronoPass API  |   "errors": [
1|ChronoPass API  |     {
1|ChronoPass API  |       "code": "error.invalidVersion"
1|ChronoPass API  |     }
1|ChronoPass API  |   ]
1|ChronoPass API  | }
cubehouse commented 5 years ago

Fixed! logic fart. The network request function was also changing the internal API version. This was wrong. That function should just fetch the version, not mess with the object state.

So, now when called, it doesn't do anything other than its job, then the next bit updates the object state, which means it will restore correctly from cache too.

Published in 5.1.3