Closed Sin-Nguyen closed 1 year ago
@Sin-Nguyen Can you tell me which version of appium-device-farm your using?
@saikrishna321 I using device-farm@3.5.0
@Sin-Nguyen Please try with the latest version and let me know.
hi @saikrishna321 , After upgrade plugin device-farm
to 3.15.0
,the issue still happening
2023-01-16 13:07:45:454 - [HTTP] {"capabilities":{"alwaysMatch":{"platformName":"Android","appium:autoGrantPermissions":true,"appium:noReset":true,"appium:fullReset":false,"appium:automationName":"UiAutomator2","appium:newCommandTimeout":30000,"appium:autoWebviewTimeout":20000,"appium:dontStopAppOnReset":true}}}
2023-01-16 13:07:45:454 - [debug] [AppiumDriver@83d5] Calling AppiumDriver.createSession() with args: [null,null,{"alwaysMatch":{"platformName":"Android","appium:autoGrantPermissions":true,"appium:noReset":true,"appium:fullReset":false,"appium:automationName":"UiAutomator2","appium:newCommandTimeout":30000,"appium:autoWebviewTimeout":20000,"appium:dontStopAppOnReset":true}}]
2023-01-16 13:07:45:455 - [AppiumDriver@83d5] Plugins which can handle cmd 'createSession': device-farm
2023-01-16 13:07:45:455 - [AppiumDriver@83d5] Plugin device-farm is now handling cmd 'createSession'
2023-01-16 13:07:45:455 - [AppiumDriver@83d5] 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"].
2023-01-16 13:07:45:456 - [debug] [AppiumDriver@83d5] Encountered internal error running command: TypeError: Cannot read properties of undefined (reading '0')
2023-01-16 13:07:45:456 - [debug] [AppiumDriver@83d5] at DevicePlugin.<anonymous> (/Users/nsin/.appium/node_modules/appium-device-farm/lib/plugin.js:126:137)
2023-01-16 13:07:45:456 - [debug] [AppiumDriver@83d5] at Generator.next (<anonymous>)
2023-01-16 13:07:45:456 - [debug] [AppiumDriver@83d5] at /Users/nsin/.appium/node_modules/appium-device-farm/lib/plugin.js:8:71
2023-01-16 13:07:45:456 - [debug] [AppiumDriver@83d5] at new Promise (<anonymous>)
2023-01-16 13:07:45:456 - [debug] [AppiumDriver@83d5] at __awaiter (/Users/nsin/.appium/node_modules/appium-device-farm/lib/plugin.js:4:12)
2023-01-16 13:07:45:456 - [debug] [AppiumDriver@83d5] at DevicePlugin.createSession (/Users/nsin/.appium/node_modules/appium-device-farm/lib/plugin.js:119:16)
2023-01-16 13:07:45:457 - [debug] [AppiumDriver@83d5] at wrappedCmd (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/lib/appium.js:722:24)
2023-01-16 13:07:45:457 - [debug] [AppiumDriver@83d5] at AppiumDriver.executeWrappedCommand (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/lib/appium.js:762:22)
2023-01-16 13:07:45:457 - [debug] [AppiumDriver@83d5] at AppiumDriver.executeCommand (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/lib/appium.js:684:28)
2023-01-16 13:07:45:457 - [debug] [AppiumDriver@83d5] at asyncHandler (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/@appium/base-driver/lib/protocol/protocol.js:346:32)
2023-01-16 13:07:45:457 - [debug] [AppiumDriver@83d5] at /Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/@appium/base-driver/lib/protocol/protocol.js:462:15
2023-01-16 13:07:45:457 - [debug] [AppiumDriver@83d5] at Layer.handle [as handle_request] (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5)
2023-01-16 13:07:45:458 - [debug] [AppiumDriver@83d5] at next (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/express/lib/router/route.js:144:13)
2023-01-16 13:07:45:458 - [debug] [AppiumDriver@83d5] at Route.dispatch (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/express/lib/router/route.js:114:3)
2023-01-16 13:07:45:458 - [debug] [AppiumDriver@83d5] at Layer.handle [as handle_request] (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5)
2023-01-16 13:07:45:458 - [debug] [AppiumDriver@83d5] at /Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/express/lib/router/index.js:284:15
2023-01-16 13:07:45:458 - [debug] [AppiumDriver@83d5] at Function.process_params (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/express/lib/router/index.js:346:12)
2023-01-16 13:07:45:458 - [debug] [AppiumDriver@83d5] at next (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/express/lib/router/index.js:280:10)
2023-01-16 13:07:45:458 - [debug] [AppiumDriver@83d5] at /Users/nsin/.appium/node_modules/appium-device-farm/lib/wd-command-proxy.js:58:20
2023-01-16 13:07:45:458 - [debug] [AppiumDriver@83d5] at Generator.next (<anonymous>)
2023-01-16 13:07:45:458 - [debug] [AppiumDriver@83d5] at /Users/nsin/.appium/node_modules/appium-device-farm/lib/wd-command-proxy.js:8:71
2023-01-16 13:07:45:459 - [debug] [AppiumDriver@83d5] at new Promise (<anonymous>)
2023-01-16 13:07:45:459 - [debug] [AppiumDriver@83d5] at __awaiter (/Users/nsin/.appium/node_modules/appium-device-farm/lib/wd-command-proxy.js:4:12)
2023-01-16 13:07:45:459 - [debug] [AppiumDriver@83d5] at handler (/Users/nsin/.appium/node_modules/appium-device-farm/lib/wd-command-proxy.js:55:12)
2023-01-16 13:07:45:459 - [debug] [AppiumDriver@83d5] at Layer.handle [as handle_request] (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5)
2023-01-16 13:07:45:459 - [debug] [AppiumDriver@83d5] at trim_prefix (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/express/lib/router/index.js:328:13)
2023-01-16 13:07:45:459 - [debug] [AppiumDriver@83d5] at /Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/express/lib/router/index.js:286:9
2023-01-16 13:07:45:459 - [debug] [AppiumDriver@83d5] at Function.process_params (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/express/lib/router/index.js:346:12)
2023-01-16 13:07:45:459 - [debug] [AppiumDriver@83d5] at next (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/express/lib/router/index.js:280:10)
2023-01-16 13:07:45:459 - [debug] [AppiumDriver@83d5] at logger (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/morgan/index.js:144:5)
2023-01-16 13:07:45:460 - [debug] [AppiumDriver@83d5] at Layer.handle [as handle_request] (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5)
2023-01-16 13:07:45:460 - [debug] [AppiumDriver@83d5] at trim_prefix (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/express/lib/router/index.js:328:13)
2023-01-16 13:07:45:460 - [debug] [AppiumDriver@83d5] at /Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/express/lib/router/index.js:286:9
2023-01-16 13:07:45:460 - [debug] [AppiumDriver@83d5] at Function.process_params (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/express/lib/router/index.js:346:12)
2023-01-16 13:07:45:461 - [HTTP] <-- POST /wd/hub/session 500 7 ms - 766
❯ appium plugin list
✔ Listing available plugins
- relaxed-caps@1.0.0-beta.13 [installed (NPM)]
- execute-driver@2.0.6 [installed (NPM)]
- device-farm@3.15.0 [installed (NPM)]
- appium-dashboard@v2.0.0 [installed (NPM)]
- images [not installed]
@Sin-Nguyen Can you should add full appium logs please and also your client Capability code.
The appium full log: https://gist.github.com/Sin-Nguyen/424a5e7643ad47b7b8de317c3285c790 This is capabilities before I delete session
path: '/wd/hub',
platform: 'Android',
desiredCapabilities: {
'appium:appPackage': 'com.tencent.mm',
'appium:appActivity': 'com.tencent.mm.ui.LauncherUI',
'appium:autoGrantPermissions': true,
'appium:noReset': true,
'appium:fullReset': false,
'appium:automationName': 'UiAutomator2',
'appium:newCommandTimeout': 30000,
'appium:autoWebviewTimeout': 20000,
'appium:session-override': true,
}
And this is capabilities for init new session
alwaysMatch: {
platformName: 'Android',
'appium:autoGrantPermissions': true,
'appium:noReset': true,
'appium:fullReset': false,
'appium:automationName': 'UiAutomator2',
'appium:newCommandTimeout': 30000,
'appium:autoWebviewTimeout': 20000,
'appium:dontStopAppOnReset': true,
}
This is my Appium config json -> https://gist.github.com/Sin-Nguyen/de34426523ac9b6f868f0da17eae917f
@saikrishna321 Here my logs when run commands
I tried with Appium API. Cannot start new session normally when use device-farm
plugin
curl --location --request POST 'localhost:4725/wd/hub/session' \
--header 'Content-Type: application/json' \
--data-raw '{
"capabilities": {
"alwaysMatch": {
"platformName": "android",
"appium:appPackage": "com.tencent.mm",
"appium:appActivity": "com.tencent.mm.ui.LauncherUI",
"appium:autoGrantPermissions": true,
"appium:noReset": true,
"appium:fullReset": false,
"appium:automationName": "UiAutomator2",
"appium:newCommandTimeout": 30000,
"appium:autoWebviewTimeout": 20000,
"appium:session-override": true
}
}
}'
{
"value": {
"error": "unknown error",
"message": "An unknown server-side error occurred while processing the command. Original error: Cannot read properties of undefined (reading '0')",
"stacktrace": "UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot read properties of undefined (reading '0')\n at getResponseForW3CError (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/@appium/base-driver/lib/protocol/errors.js:956:9)\n at asyncHandler (/Users/nsin/.nvm/versions/node/v16.18.0/lib/node_modules/appium/node_modules/@appium/base-driver/lib/protocol/protocol.js:435:35)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)"
}
}
I turn 2 appium with 2 different port (one has port 4724 and one has port 4725) with:
device-farm
plugin and working no issue.Port 4725 :
@Sin-Nguyen The problem is some how your client is sending a create session without firstMatch. So checking on that.
Are you sending this request from postman without firstMatch
https://gist.github.com/Sin-Nguyen/424a5e7643ad47b7b8de317c3285c790#file-appium-log-L296-L297
Which client are you using to run your test and the client version? AS a part of w3c you should have alwaysMatch and firstMatch.
@saikrishna321
Are you sending this request from postman without firstMatch
alwayMatch
instead of firstMatch
Which client are you using to run your test and the client version? AS a part of w3c you should have alwaysMatch and firstMatch.
alwayMatch
object instead of firstMatch
object.@Sin-Nguyen https://gist.github.com/Sin-Nguyen/424a5e7643ad47b7b8de317c3285c790#file-appium-log-L296-L297 This request has the firstMatch. I believe this coming from CodeceptJS.
@saikrishna321 After change alwayMatch
to firstMatch
. My test scripts working well. Thank you very much for investigating. 👍
Describe the bug
Hi , in my framework, I have to delete current session and create new session and override it into my framework. In the past, I can use this solution with appium 2.0 but when I enable this plugin with appium, I cannot use anymore. Note : Delete session still working but the command
createSession
not working Please help me to fix it Thank you very muchLink to Appium logs
https://gist.github.com/Sin-Nguyen/6ed9126b3039e06c169e48dc1e52304e -> Log when I found issue
Appium capabilities Caps old session :
Caps new session
Environment