appium-device-farm
appium-device-farm copied to clipboard
Unable to create session through device farm getting AxiosError after setup is done
Issue Details
Installed latest appium version 2.12.1 and device farm plugin 9.4.5. Started appium server with appium device farm plugin enabled. Connected to local host device farm URL (http://localhost:4723/device-farm/). When I clicked on Use Device for available devices, unable to create session got below error.
Logs
[device-farm-main] Received error from remote node: {"message":"Request failed with status code 500","name":"AxiosError","stack":"AxiosError: Request failed with status code 500\n at settle (/Users/.../.appium/node_modules/appium-device-farm/node_modules/axios/lib/core/settle.js:19:12)\n at IncomingMessage.handleStreamEnd (/Users/.../.appium/node_modules/appium-device-farm/node_modules/axios/lib/adapters/http.js:599:11)\n at IncomingMessage.emit (node:events:532:35)\n at endReadableNT (node:internal/streams/readable:1696:12)\n at processTicksAndRejections (node:internal/process/task_queues:82:21)\n at Axios.request (/Users/nagaruru.vyshnavi/.appium/node_modules/appium-device-farm/node_modules/axios/lib/core/Axios.js:45:41)\n at processTicksAndRejections (node:internal/process/task_queues:95:5)","config":{"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"adapter":["xhr","http","fetch"],"transformRequest":[null],"transformResponse":[null],"timeout":260000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"env":{},"headers":{"Accept":"application/json, text/plain, /","Content-Type":"application/json","User-Agent":"axios/1.7.7","Content-Length":"555","Accept-Encoding":"gzip, compress, deflate, br"},"method":"post","url":"http://127.0.0.1:4723/wd/hub/session","data":"{"capabilities":{"alwaysMatch":{"platformName":"android","appium:automationName":"UIAutomator2","appium:newCommandTimeout":120,"appium:waitForIdleTimeout":10,"appium:udid":"RZ8N800R06E","df:skipReport":true,"appium:systemPort":54035,"appium:adbExecTimeout":80000,"appium:uiautomator2ServerLaunchTimeout":60000},"firstMatch":[{}]},"desiredCapabilities":{"platformName":"android","appium:automationName":"UIAutomator2","appium:newCommandTimeout":120,"appium:waitForIdleTimeout":10,"appium:udid":"RZ8N800R06E","df:skipReport":true,"appium:systemPort":54035}}"},"code":"ERR_BAD_RESPONSE","status":500} [HTTP] <-- POST /device-farm/api/dashboard/appiumSession 400 1107 ms - 886
Version Details npm version - 10.8.1 node version - v22.4.1 appium version - v2.12.1 device farm plugin - v9.4.5
Hi @VyshnaviNagaruru,
Can you try below command and try again please ?
appium plugin run device-farm reset
Hi @erdncyz
Tried this command appium plugin run device-farm reset, but getting same error
[AppiumDriver@14d4] Command 'createSession' was not handled by the following behaviours or plugins, even though they were registered to handle it: ["default"]. The command was handled by these: ["device-farm"]. [AppiumDriver@14d4] The thrown error object does not seem to be a valid instance of the Error class. This might be a genuine bug of a driver or a plugin. [AppiumDriver@14d4] Encountered internal error running command: undefined [HTTP] <-- POST /wd/hub/session 500 1254 ms - 855 [device-farm-main] Received error from remote node: {"message":"Request failed with status code 500","name":"AxiosError","stack":"AxiosError: Request failed with status code 500\n at settle (/Users/.../.appium/node_modules/appium-device-farm/node_modules/axios/lib/core/settle.js:19:12)\n at IncomingMessage.handleStreamEnd (/Users/.../.appium/node_modules/appium-device-farm/node_modules/axios/lib/adapters/http.js:599:11)\n at IncomingMessage.emit (node:events:532:35)\n at endReadableNT (node:internal/streams/readable:1696:12)\n at processTicksAndRejections (node:internal/process/task_queues:82:21)\n at Axios.request (/Users/.../.appium/node_modules/appium-device-farm/node_modules/axios/lib/core/Axios.js:45:41)\n at processTicksAndRejections (node:internal/process/task_queues:95:5)","config":{"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"adapter":["xhr","http","fetch"],"transformRequest":[null],"transformResponse":[null],"timeout":260000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"env":{},"headers":{"Accept":"application/json, text/plain, /","Content-Type":"application/json","User-Agent":"axios/1.7.7","Content-Length":"555","Accept-Encoding":"gzip, compress, deflate, br"},"method":"post","url":"http://127.0.0.1:4723/wd/hub/session","data":"{"capabilities":{"alwaysMatch":{"platformName":"android","appium:automationName":"UIAutomator2","appium:newCommandTimeout":120,"appium:waitForIdleTimeout":10,"appium:udid":"RZ8N800R06E","df:skipReport":true,"appium:systemPort":55789,"appium:adbExecTimeout":80000,"appium:uiautomator2ServerLaunchTimeout":60000},"firstMatch":[{}]},"desiredCapabilities":{"platformName":"android","appium:automationName":"UIAutomator2","appium:newCommandTimeout":120,"appium:waitForIdleTimeout":10,"appium:udid":"RZ8N800R06E","df:skipReport":true,"appium:systemPort":55789}}"},"code":"ERR_BAD_RESPONSE","status":500}
Did you open develeoper mode on your devices ? ı think that this issue deal with your devices or your devices connection.
Developer Options are enabled and able to perform execution with appium. Issue is observed only when appium server started with appium device farm plugin. Unable to create session from appium device farm local host.
What is your device os version
@VyshnaviNagaruru please provide full server logs
ServerLogs.txt Please find the logs. @saikrishna321 . For all devices same issue is observed. Currently version 12 I'm using.
Hi @VyshnaviNagaruru,
Appium device-farm stream (Screen 2) is installed for your devices ? İf not can you check screen 1 settings in Developer mode page
Screen 1
Screen 2
@erdncyz Appium Device Farm is not installed in my device, but option shared in screen 1 is enabled (Verify Apps over USB)
Hi @VyshnaviNagaruru
can you try install manually please and then try again? Can you install in "https://github.com/AppiumTestDistribution/appium-device-farm/blob/main/device-farm.apk" here. We can understand problem deal with this issue.
@erdncyz Installed device-farm.apk manually and started server, still same issue is observed it is not communicating with apk installed in device.
Error Logs:
[device-farm-main] Streaming apk not present, so downloading.. [AppiumDriver@ae8d] Command 'createSession' was not handled by the following behaviours or plugins, even though they were registered to handle it: ["default"]. The command was handled by these: ["device-farm"]. [AppiumDriver@ae8d] The thrown error object does not seem to be a valid instance of the Error class. This might be a genuine bug of a driver or a plugin. [AppiumDriver@ae8d] Encountered internal error running command: undefined [HTTP] <-- POST /wd/hub/session 500 257 ms - 855 [device-farm-main] Received error from remote node: {"message":"Request failed with status code 500","name":"AxiosError","stack":"AxiosError: Request failed with status code 500\n at settle (/Users/nagaruru.vyshnavi/.appium/node_modules/appium-device-farm/node_modules/axios/lib/core/settle.js:19:12)\n at IncomingMessage.handleStreamEnd (/Users/nagaruru.vyshnavi/.appium/node_modules/appium-device-farm/node_modules/axios/lib/adapters/http.js:599:11)\n at IncomingMessage.emit (node:events:532:35)\n at endReadableNT (node:internal/streams/readable:1696:12)\n at processTicksAndRejections (node:internal/process/task_queues:82:21)\n at Axios.request (/Users/nagaruru.vyshnavi/.appium/node_modules/appium-device-farm/node_modules/axios/lib/core/Axios.js:45:41)\n at processTicksAndRejections (node:internal/process/task_queues:95:5)","config":{"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"adapter":["xhr","http","fetch"],"transformRequest":[null],"transformResponse":[null],"timeout":260000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"env":{},"headers":{"Accept":"application/json, text/plain, /","Content-Type":"application/json","User-Agent":"axios/1.7.7","Content-Length":"555","Accept-Encoding":"gzip, compress, deflate, br"},"method":"post","url":"http://127.0.0.1:4723/wd/hub/session","data":"{"capabilities":{"alwaysMatch":{"platformName":"android","appium:automationName":"UIAutomator2","appium:newCommandTimeout":120,"appium:waitForIdleTimeout":10,"appium:udid":"RZ8N800R06E","df:skipReport":true,"appium:systemPort":55532,"appium:adbExecTimeout":80000,"appium:uiautomator2ServerLaunchTimeout":60000},"firstMatch":[{}]},"desiredCapabilities":{"platformName":"android","appium:automationName":"UIAutomator2","appium:newCommandTimeout":120,"appium:waitForIdleTimeout":10,"appium:udid":"RZ8N800R06E","df:skipReport":true,"appium:systemPort":55532}}"},"code":"ERR_BAD_RESPONSE","status":500}
Received error from remote node: {"message":"Request failed with status code 500","name":"AxiosError","stack":"AxiosError: Request failed with status code 500\n at settle (/Users/coet_admin/.appium/node_modules/appium-device-farm/node_modules/axios/lib/core/settle.js:19:12)\n at IncomingMessage.handleStreamEnd (/Users/coet_admin/.appium/node_modules/appium-device-farm/node_modules/axios/lib/adapters/http.js:599:11)\n at IncomingMessage.emit (node:events:526:35)\n at endReadableNT (node:internal/streams/readable:1359:12)\n at processTicksAndRejections (node:internal/process/task_queues:82:21)\n at Axios.request (/Users/coet_admin/.appium/node_modules/appium-device-farm/node_modules/axios/lib/core/Axios.js:45:41)\n at processTicksAndRejections (node:internal/process/task_queues:95:5)","config":{"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"adapter":["xhr","http","fetch"],"transformRequest":[null],"transformResponse":[null],"timeout":260000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"env":{},"headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json","User-Agent":"axios/1.7.9","Content-Length":"595","Accept-Encoding":"gzip, compress, deflate, br"},"method":"post","url":"http://coet-xxx:4723/wd/hub/session","data":"{\"capabilities\":{\"alwaysMatch\":{\"platformName\":\"android\",\"appium:automationName\":\"UIAutomator2\",\"appium:newCommandTimeout\":120,\"appium:waitForIdleTimeout\":10,\"appium:udid\":\"RZCxxxx\",\"df:skipReport\":true,\"df:liveVideo\":true,\"appium:systemPort\":62807,\"appium:adbExecTimeout\":80000,\"appium:uiautomator2ServerLaunchTimeout\":60000},\"firstMatch\":[{}]},\"desiredCapabilities\":{\"platformName\":\"android\",\"appium:automationName\":\"UIAutomator2\",\"appium:newCommandTimeout\":120,\"appium:waitForIdleTimeout\":10,\"appium:udid\":\"RZCxxxx\",\"df:skipReport\":true,\"df:liveVideo\":true,\"appium:systemPort\":62807}}"},"code":"ERR_BAD_RESPONSE","status":500}
I see a similar problem with myself. With version 9.4.5 it seems to be working. Could you please take a look at it?
In which version you are getting this error?
In current 9.5.0, but I have seen this issue in versions > 9.4.5
I think the same error
Gist : https://gist.github.com/erdncyz/ebd1e5035de3216117f29cf15b279cef
https://github.com/AppiumTestDistribution/appium-device-farm/issues/1514