AppiumTestDistribution / appium-device-farm

This is an Appium 2.0 plugin designed to manage and create driver sessions on available devices.
https://devicefarm.org
Other
335 stars 102 forks source link

Unable to create session on remote device (while it works on local device) #786

Closed saikrishna321 closed 1 year ago

saikrishna321 commented 1 year ago

Discussed in https://github.com/AppiumTestDistribution/appium-device-farm/discussions/740

Originally posted by **ShubhangiShingade** July 10, 2023 I have a hub and node setup with each running a android simulator. Both node and hub can access the dashboard, device farm. However the test fails to create session on remote simulator while it succeeds on local simulator. [debug] [AppiumDriver@fb34] Calling AppiumDriver.createSession() with args: [null,null,{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android","appium:app":"/Users/shubhangi/Downloads/app-google-mobile-release_4.0.8.0.167159.apk","appium:deviceName":"emulator-5554","appium:deviceOrientation":"portrait","appium:platformVersion":"14","appium:automationName":"UiAutomator2","appium:newCommandTimeout":3000,"appium:appWaitActivity":"com.ixolit.ipvanish*","appium:autoGrantPermissions":"true"}}] [AppiumDriver@fb34] Plugins which can handle cmd 'createSession': device-farm,appium-dashboard [AppiumDriver@fb34] Plugin appium-dashboard is now handling cmd 'createSession' [AppiumDriver@fb34] Plugin device-farm is now handling cmd 'createSession' { platformName: 'Android', 'appium:app': '/Users/shubhangi/Downloads/app-google-mobile-release_4.0.8.0.167159.apk', 'appium:deviceName': 'emulator-5554', 'appium:deviceOrientation': 'portrait', 'appium:platformVersion': '14', 'appium:automationName': 'UiAutomator2', 'appium:newCommandTimeout': 3000, 'appium:appWaitActivity': 'com.ixolit.ipvanish*', 'appium:autoGrantPermissions': 'true', 'appium:clearDeviceLogsOnStart': true, 'appium:nativeWebScreenshot': true, 'appium:mjpegServerPort': 56296 } [device-farm] {"platform":"android","platformVersion":"14","name":"","busy":false,"userBlocked":false} [device-farm] Waiting for free device [device-farm] 📱 Device found: {"adbPort":5037,"systemPort":50963,"sdk":"14","realDevice":false,"name":"sdk_gphone64_x86_64\n name: \nnufacturer_name: 0,","busy":false,"state":"offline","udid":"emulator-5554","platform":"android","deviceType":"emulator","host":"http://192.168.1.120:4723","totalUtilizationTimeMilliSec":0,"sessionStartTime":0,"offline":false,"userBlocked":false,"meta":{"revision":2,"created":1688982088944,"version":0,"updated":1688982302731},"$loki":1,"dashboard_link":"http://10.120.75.2:31337/dashboard?device_udid=emulator-5554&start_time=2023-07-10T09:39:12.376Z","total_session_count":0,"newCommandTimeout":3000} [device-farm] 📱 Blocking device emulator-5554 for new session [device-farm] Remote Host URL - http://192.168.1.120:4723/wd/hub/session [device-farm] Creating cloud session [HTTP] --> GET /device-farm/api/devices [HTTP] {} [HTTP] --> GET /dashboard/api/sessions?start_time=2023-07-10T09:39:12.376Z [HTTP] {} [HTTP] <-- GET /dashboard/api/sessions?start_time=2023-07-10T09:39:12.376Z 200 3 ms - 47 [HTTP] [HTTP] <-- GET /device-farm/api/devices 200 50 ms - 1160 [HTTP] [HTTP] --> GET /device-farm/api/queue [HTTP] {} [HTTP] <-- GET /device-farm/api/queue 200 1 ms - 1 ... .... ... [device-farm] 📱 Device UDID emulator-5554 unblocked. Reason: Remote Session failed to create [AppiumDriver@fb34] 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","appium-dashboard"]. [debug] [AppiumDriver@fb34] Encountered internal error running command: TypeError: Cannot read properties of undefined (reading 'data') [debug] [AppiumDriver@fb34] at /Users/shubhangi/.appium/node_modules/appium-device-farm/lib/plugin.js:174:59 [debug] [AppiumDriver@fb34] at Generator.next () [debug] [AppiumDriver@fb34] at fulfilled (/Users/shubhangi/.appium/node_modules/appium-device-farm/lib/plugin.js:5:58) [debug] [AppiumDriver@fb34] at runMicrotasks () [debug] [AppiumDriver@fb34] at processTicksAndRejections (node:internal/process/task_queues:96:5) [HTTP] <-- POST /wd/hub/session 500 60008 ms - 715 Has anyone encountered this before, if so how did you fix it ? Thanks, Shubhangi
saikrishna321 commented 1 year ago

@ShubhangiShingade I'm unable to reproduce this issue. Can you check the device-farm dashboard http://nodeproxyIP:port/device-farm/ if the device is available.

ShubhangiShingade commented 1 year ago

@saikrishna321 Yes, the device is seen on the dashboard and the device location shown as -10.120.75.11. The device also gets busy for some time

Can you please confirm if I am using the proxy IP correctly ? Note me and my colleague are connected to one VPN.

{ "server": { "address": "10.120.75.2", "port": 31337, "plugin": { "device-farm": { "platform": "both" } } } }

{ "server": { "address": "10.120.75.11", "port": 4723, "plugin": { "device-farm": { "platform": "android", "proxyIP": "http://10.120.75.11:4723/", "hub": "http://10.120.75.2:31337/" } } } }

Logs- https://gist.github.com/ShubhangiShingade/bc7381a26ee50cf60c16192ff114d418

ShubhangiShingade commented 1 year ago

@saikrishna321 Can you please confirm if I am using the right configuration ?