zebrunner / stf

Mirror for git@github.com:openstf/stf.git repository
Other
30 stars 18 forks source link

Apple TV: Winding down for graceful exit, with optional error : StatusCodeError: 404 #967

Closed dhreben closed 3 months ago

dhreben commented 3 months ago

Steps:

  1. Open Apple TV - >device is crashed on STF

Actual result: Winding down for graceful exit, with optional error : StatusCodeError: 404

2024-05-22T11:14:59.402Z INF/device:info 48 [bd03d002eae5d3087074198596cec3a0faf72a7d] device.name: Apple_TV
Connected to WdaMjpeg connector:8101
2024-05-22T11:35:48.309Z IMP/device:plugins:group 48 [bd03d002eae5d3087074198596cec3a0faf72a7d] Now owned by "admin@fakedomain.com"
2024-05-22T11:35:48.310Z INF/device:plugins:group 48 [bd03d002eae5d3087074198596cec3a0faf72a7d] Subscribing to group channel "kKN8pwewTDS6siN8ouyh2w=="
2024-05-22T11:35:49.360Z INF/wdaClient 48 [bd03d002eae5d3087074198596cec3a0faf72a7d] verifying wda session status...
2024-05-22T11:35:49.371Z INF/wdaClient 48 [bd03d002eae5d3087074198596cec3a0faf72a7d] Reusing device type value: iPhone
2024-05-22T11:35:49.380Z VRB/wdaClient 48 [bd03d002eae5d3087074198596cec3a0faf72a7d] Request has been sent to WDA with data: {"method":"POST","uri":"http://connector:8100/session","body":{"capabilities":{}},"json":true}
2024-05-22T11:35:49.399Z VRB/wdaClient 48 [bd03d002eae5d3087074198596cec3a0faf72a7d] Request has been sent to WDA with data: {"method":"GET","uri":"http://connector:8100/status","json":true}
2024-05-22T11:35:49.400Z INF/wdaClient 48 [bd03d002eae5d3087074198596cec3a0faf72a7d] status response: {"value":{"build":{"time":"May 22 2024 13:52:01","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"},"os":{"testmanagerdVersion":65535,"name":"tvOS","sdkVersion":"17.4","version":"17.4"},"device":"apple tv","ios":{"ip":"169.254.233.23"},"message":"WebDriverAgent is ready to accept commands","state":"success","ready":true},"sessionId":"2DC760FA-08BD-46CC-A49F-74D743C6A256"}
2024-05-22T11:35:49.401Z INF/wdaClient 48 [bd03d002eae5d3087074198596cec3a0faf72a7d] reusing existing wda session: 2DC760FA-08BD-46CC-A49F-74D743C6A256
2024-05-22T11:35:49.402Z INF/wdaClient 48 [bd03d002eae5d3087074198596cec3a0faf72a7d] Setting device version: 17.4
2024-05-22T11:35:49.403Z INF/wdaClient 48 [bd03d002eae5d3087074198596cec3a0faf72a7d] getting device window size...
2024-05-22T11:35:49.412Z INF/wdaClient 48 [bd03d002eae5d3087074198596cec3a0faf72a7d] Reusing device size/scale
2024-05-22T11:35:49.418Z INF/util:lifecycle 48 [bd03d002eae5d3087074198596cec3a0faf72a7d] Winding down for graceful exit, with optional error : StatusCodeError: 404 - {"value":{"error":"unknown command","message":"Unhandled endpoint: /session/2DC760FA-08BD-46CC-A49F-74D743C6A256/orientation -- http://connector:8100/ with parameters {\n  wildcards =   (\n    \"session/2DC760FA-08BD-46CC-A49F-74D743C6A256/orientation\"\n  );\n}","traceback":""},"sessionId":"2DC760FA-08BD-46CC-A49F-74D743C6A256"}
  at new StatusCodeError (/opt/node_modules/request-promise-core/lib/errors.js:32:15)
  at Request.plumbing.callback (/opt/node_modules/request-promise-core/lib/plumbing.js:104:33)
  at Request.RP$callback [as _callback] (/opt/node_modules/request-promise-core/lib/plumbing.js:46:31)
  at Request.self.callback (/opt/node_modules/request/request.js:185:22)
  at Request.emit (node:events:527:28)
  at Request.<anonymous> (/opt/node_modules/request/request.js:1154:10)
  at Request.emit (node:events:527:28)
  at IncomingMessage.<anonymous> (/opt/node_modules/request/request.js:1076:12)
  at Object.onceWrapper (node:events:641:28)
  at IncomingMessage.emit (node:events:539:35)
  at endReadableNT (node:internal/streams/readable:1345:12)
  at processTicksAndRejections (node:internal/process/task_queues:83:21) {
 statusCode: 404,
 error: {
  value: {
   error: 'unknown command',
   message: 'Unhandled endpoint: /session/2DC760FA-08BD-46CC-A49F-74D743C6A256/orientation -- http://connector:8100/ with parameters {\n' +
    '  wildcards =   (\n' +
    '    "session/2DC760FA-08BD-46CC-A49F-74D743C6A256/orientation"\n' +
    '  );\n' +
    '}',
   traceback: ''
  },
  sessionId: '2DC760FA-08BD-46CC-A49F-74D743C6A256'
 },
 options: {
  method: 'GET',
  uri: 'http://connector:8100/session/2DC760FA-08BD-46CC-A49F-74D743C6A256/orientation',
  json: true,
  callback: [Function: RP$callback],
  transform: undefined,
  simple: true,
  resolveWithFullResponse: false,
  transform2xxOnly: false
 },
 response: <ref *1> IncomingMessage {
  _readableState: ReadableState {
   objectMode: false,
   highWaterMark: 16384,
   buffer: BufferList { head: null, tail: null, length: 0 },
   length: 0,
   pipes: [],
   flowing: true,
   ended: true,
   endEmitted: true,
   reading: false,
   constructed: true,
   sync: true,
   needReadable: false,
   emittedReadable: false,
   readableListening: false,
   resumeScheduled: false,
   errorEmitted: false,
   emitClose: true,
   autoDestroy: true,
   destroyed: true,
   errored: null,
   closed: true,
   closeEmitted: true,
   defaultEncoding: 'utf8',
   awaitDrainWriters: null,
   multiAwaitDrain: false,
   readingMore: true,
   dataEmitted: true,
   decod
   _keepAliveTimeout: 0,
   _onPendingData: [Function: nop],
   agent: [Agent],
   socketPath: undefined,
   method: 'GET',
   maxHeaderSize: undefined,
   insecureHTTPParser: undefined,
   path: '/session/2DC760FA-08BD-46CC-A49F-74D743C6A256/orientation',
   _ended: true,
   res: [Circular *1],
   aborted: false,
   timeoutCb: null,
   upgradeOrConnect: false,
   parser: null,
   maxHeadersCount: null,
   reusedSocket: false,
   host: 'connector',
   protocol: 'http:',
   [Symbol(kCapture)]: false,
   [Symbol(kNeedDrain)]: false,
   [Symbol(corked)]: 0,
   [Symbol(kOutHeaders)]: [Object: null prototype]
  },
  request: Request {
   _events: [Object: null prototype],
   _eventsCount: 5,
   _maxListeners: undefined,
   method: 'GET',
   uri: [Url],
   readable: true,
   writable: true,
   explicitMethod: true,
   _qs: [Querystring],
   _auth: [Auth],
   _oauth: [OAuth],
   _multipart: [Multipart],
   _redirect: [Redirect],
   _tunnel: [Tunnel],
   _rp_resolve: [Function (anonymous)],
   _rp_reject: [Function (anonymous)],
   _rp_promise: [Promise [Object]],
   _rp_callbackOrig: undefined,
   callback: [Function (anonymous)],
   _rp_options: [Object],
   headers: [Object],
   setHeader: [Function (anonymous)],
   hasHeader: [Function (anonymous)],
   getHeader: [Function (anonymous)],
   removeHeader: [Function (anonymous)],
   localAddress: undefined,
   pool: {},
   dests: [],
   __isRequestRequest: true,
   _callback: [Function: RP$callback],
   proxy: null,
   tunnel: false,
   setHost: true,
   originalCookieHeader: undefined,
   _disableCookies: true,
   _jar: undefined,
   port: '8100',
   host: 'connector',
   path: '/session/2DC760FA-08BD-46CC-A49F-74D743C6A256/orientation',
   _json: true,
   httpModule: [Object],
   agentClass: [Function],
   agent: [Agent],
   _started: true,
   href: 'http://connector:8100/session/2DC760FA-08BD-46CC-A49F-74D743C6A256/orientation',
   req: [ClientRequest],
   ntick: true,
   response: [Circular *1],
   originalHost: 'connector:8100',
   originalHostHeaderName: 'host',
   responseContent: [Circular *1],
   _destdata: true,
   _ended: true,
   _callbackCalled: true,
   [Symbol(kCapture)]: false
  },
  toJSON: [Function: responseToJSON],
  caseless: Caseless { dict: [Object] },
  body: {
   value: [Object],
   sessionId: '2DC760FA-08BD-46CC-A49F-74D743C6A256'
  },
  [Symbol(kCapture)]: false,
  [Symbol(kHeaders)]: {
   server: 'WebDriverAgent/1.0',
   'content-type': 'application/json;charset=UTF-8',
   'access-control-allow-origin': '*',
   date: 'Wed, 22 May 2024 11:35:49 GMT',
   'access-control-allow-headers': 'Content-Type, X-Requested-With',
   'accept-ranges': 'bytes',
   'content-length': '384',
   connection: 'close'
  },
  [Symbol(kHeadersCount)]: 16,
  [Symbol(kTrailers)]: null,
  [Symbol(kTrailersCount)]: 0,
  [Symbol(RequestTimeout)]: undefined
 }
}
2024-05-22T11:35:49.425Z FTL/util:lifecycle 48 [bd03d002eae5d3087074198596cec3a0faf72a7d] Shutting down due to fatal error with optional error : StatusCodeError: 404 - {"value":{"error":"unknown command","message":"Unhandled endpoint: /session/2DC760FA-08BD-46CC-A49F-74D743C6A256/orientation -- http://connector:8100/ with parameters {\n  wildcards =   (\n    \"session/2DC760FA-08BD-46CC-A49F-74D743C6A256/orientation\"\n  );\n}","traceback":""},"sessionId":"2DC760FA-08BD-46CC-A49F-74D743C6A256"}
  at new StatusCodeError (/opt/node_modules/request-promise-core/lib/errors.js:32:15)
  at Request.plumbing.callback (/opt/node_modules/request-promise-core/lib/plumbing.js:104:33)
  at Request.RP$callback [as _callback] (/opt/node_modules/request-promise-core/lib/plumbing.js:46:31)
  at Request.self.callback (/opt/node_modules/request/request.js:185:22)
  at Request.emit (node:events:527:28)
  at Request.<anonymous> (/opt/node_modules/request/request.js:1154:10)
  at Request.emit (node:events:527:28)
  at IncomingMessage.<anonymous> (/opt/node_modules/request/request.js:1076:12)
  at Object.onceWrapper (node:events:641:28)
  at IncomingMessage.emit (node:events:539:35)
  at endReadableNT (node:internal/streams/readable:1345:12)
  at processTicksAndRejections (node:internal/process/task_queues:83:21) {
 statusCode: 404,
 error: {
ignacionar commented 3 months ago

Done: https://github.com/zebrunner/stf/pull/968

The device should be deleted from the DB and implemented again to STF with new changes.

curl -X DELETE -H "Authorization: Bearer <token>" -H 'Content-Type: application/json' https://demo.zebrunner.farm/api/v1/devices/<udid> | jq .

Replace <token> and <udid> with the correct values

vdelendik commented 3 months ago

@dhreben, device removal is also possible via STF UI!

dhreben commented 3 months ago

implemented for testing:

dhreben commented 3 months ago

Fixed

Screenshot 2024-05-22 at 20 45 56