cubehouse / themeparks

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

UniversalOrlandoBase - Error 415: Unsupported Media Type #329

Closed thomasstoeckert closed 3 years ago

thomasstoeckert commented 3 years ago

Park Any park which uses universalparkbase.js is experiencing this error

Context

Describe the bug Attempting to invoke FetchWaitTimes for any Universal Orlando park will yield a "415: Unsupported Media Type" error.

Output Result of npm run testonline w/ debug flags set:

THEMEPARKS 8560: UniversalStudiosFlorida: Set useragent to Opera/9.80 (Android 4.0.4; Linux; Opera Mobi/ADR-1205181138; U; pl) Presto/2.10.254 Version/12.00
THEMEPARKS 8560: Setting up database ":memory:"

  Park UniversalStudiosFlorida
    Get Park Wait Times
THEMEPARKS 8560: Database version out-of-date. Got: 0, wants: 5
THEMEPARKS 8560: Updating database version to 1...
THEMEPARKS 8560: Updating database version to 2...
THEMEPARKS 8560: Updating database version to 3...
THEMEPARKS 8560: Updating database version to 4...
THEMEPARKS 8560: Updating database version to 5...
THEMEPARKS 8560: Making request to https://services.universalorlando.com/api/
THEMEPARKS 8560: Calling POST:https://services.universalorlando.com/api/
THEMEPARKS 8560: Network request failed attempt 1/3 for URL https://services.universalorlando.com/api/
THEMEPARKS 8560: 415: {
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
  "title": "Unsupported Media Type",
  "status": 415,
  "traceId": "00-2887bd3b31414c4d8acb89c85723dcbc-320338f7acdc6244-01"
}
THEMEPARKS 8560: Calling POST:https://services.universalorlando.com/api/
THEMEPARKS 8560: Network request failed attempt 2/3 for URL https://services.universalorlando.com/api/
THEMEPARKS 8560: 415: {
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
  "title": "Unsupported Media Type",
  "status": 415,
  "traceId": "00-f31c4ff77ad1ee45a48031f686df03e7-066e6eab9834ad42-01"
}
THEMEPARKS 8560: Calling POST:https://services.universalorlando.com/api/
THEMEPARKS 8560: Network request failed attempt 3/3 for URL https://services.universalorlando.com/api/
THEMEPARKS 8560: 415: {
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
  "title": "Unsupported Media Type",
  "status": 415,
  "traceId": "00-60cfee10a6f84549a59f49050dd24c9b-c1b190ec251bdf42-01"
}
THEMEPARKS 8560: UniversalStudiosFlorida: Error fetching Universal Access Token: 415: {
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
  "title": "Unsupported Media Type",
  "status": 415,
  "traceId": "00-60cfee10a6f84549a59f49050dd24c9b-c1b190ec251bdf42-01"
}
      1) should not return an error fetching ride times
! Unhandled Rejection!
415: {
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
  "title": "Unsupported Media Type",
  "status": 415,
  "traceId": "00-60cfee10a6f84549a59f49050dd24c9b-c1b190ec251bdf42-01"
}
Error: 415: {
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
  "title": "Unsupported Media Type",
  "status": 415,
  "traceId": "00-60cfee10a6f84549a59f49050dd24c9b-c1b190ec251bdf42-01"
}
    at <omitted>\themeparks\lib\universal\universalparkbase.js:113:33
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
! Make sure rejections are handled cleanly !
! Unhandled Rejection!
415: {
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
  "title": "Unsupported Media Type",
  "status": 415,
  "traceId": "00-60cfee10a6f84549a59f49050dd24c9b-c1b190ec251bdf42-01"
}
Error: 415: {
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
  "title": "Unsupported Media Type",
  "status": 415,
  "traceId": "00-60cfee10a6f84549a59f49050dd24c9b-c1b190ec251bdf42-01"
}
    at <omitted>\themeparks\lib\universal\universalparkbase.js:113:33
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
! Make sure rejections are handled cleanly !
      2) should have some ride data
      √ should have an ID for every ride
      √ should have a wait time for every operating ride (or should be null)
      √ should have a name for every ride
      √ should have an active state for every ride
      √ should have a fastpass field for every ride
      √ should have a status field for every ride
      √ should have matching status and active fields
    Get Schedule
      3) should not error when fetching schedule
! Unhandled Rejection!
415: {
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
  "title": "Unsupported Media Type",
  "status": 415,
  "traceId": "00-60cfee10a6f84549a59f49050dd24c9b-c1b190ec251bdf42-01"
}
Error: 415: {
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
  "title": "Unsupported Media Type",
  "status": 415,
  "traceId": "00-60cfee10a6f84549a59f49050dd24c9b-c1b190ec251bdf42-01"
}
    at <omitted>\themeparks\lib\universal\universalparkbase.js:113:33
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
! Make sure rejections are handled cleanly !
      4) should have schedule data
      √ should have a valid date for each schedule entry
      √ should have a valid opening time for each schedule entry
      √ should have a valid closing time for each schedule entry

  10 passing (5s)
  4 failing

  1) Park UniversalStudiosFlorida
       Get Park Wait Times
         should not return an error fetching ride times:
     Error: 415: {
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
  "title": "Unsupported Media Type",
  "status": 415,
  "traceId": "00-60cfee10a6f84549a59f49050dd24c9b-c1b190ec251bdf42-01"
}
      at <omitted>\themeparks\lib\universal\universalparkbase.js:113:33
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

  2) Park UniversalStudiosFlorida
       Get Park Wait Times
         should have some ride data:

      AssertionError [ERR_ASSERTION]: Not enough ride times to be valid data (<= 3), actual: 0
      + expected - actual

      -false
      +true

      at Context.<anonymous> (lib\testonline.js:84:7)
      at processImmediate (internal/timers.js:456:21)

  3) Park UniversalStudiosFlorida
       Get Schedule
         should not error when fetching schedule:
     Error: 415: {
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
  "title": "Unsupported Media Type",
  "status": 415,
  "traceId": "00-60cfee10a6f84549a59f49050dd24c9b-c1b190ec251bdf42-01"
}
      at <omitted>\themeparks\lib\universal\universalparkbase.js:113:33
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

  4) Park UniversalStudiosFlorida
       Get Schedule
         should have schedule data:

      AssertionError [ERR_ASSERTION]: Should be at least 4 schedule items. Found 0
      + expected - actual

      -false
      +true

      at Context.<anonymous> (lib\testonline.js:167:7)
      at processImmediate (internal/timers.js:456:21)

npm ERR! code ELIFECYCLE
npm ERR! errno 4
npm ERR! themeparks@5.1.39 testonline: `mocha --exit lib/testonline.js`
npm ERR! Exit status 4
npm ERR!
npm ERR! Failed at the themeparks@5.1.39 testonline script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     <omitted>
thomasstoeckert commented 3 years ago

A basic review of the error seems to imply that Universal changed the Content-Type expected for the service. Unfortunately, I don't have a proper environment set up to decode that data from my phone traffic, so I can't find out what might have changed.

cubehouse commented 3 years ago

Hi,

universalparkbase.js is not present in 5.1.46, are you sure this is the version you are using?

thomasstoeckert commented 3 years ago

I'm a fool. I've been on 5.1.39. My apologies.

Everything works in 5.1.46.