Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: node should send array of devices to hub #871

Conversation

afathonih
Copy link
Contributor

@afathonih afathonih commented Nov 7, 2023

While the endpoint requires array of device, the node does not send array. Thus, led to error as follows:

[HTTP] --> POST /device-farm/api/register?type=add
[HTTP] {"adbPort":5037,"systemPort":50128,"sdk":"13","realDevice":false,"name":"sdk_gphone64_arm64","busy":false,"state":"offline","udid":"emulator-5554","platform":"android","deviceType":"emulator","host":"http://a.b.c.d:4724","totalUtilizationTimeMilliSec":21645,"sessionStartTime":0,"userBlocked":false}
[HTTP] <-- POST /device-farm/api/register?type=add 500 9 ms - 1659
[HTTP] 
TypeError: devices.forEach is not a function
    at addNewDevice (/Users/ci/.appium/node_modules/appium-device-farm/lib/data-service/device-service.js:30:13)
    at /Users/ci/.appium/node_modules/appium-device-farm/lib/app.js:99:43
    at Layer.handle [as handle_request] (/Users/ci/.appium/node_modules/appium-device-farm/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/ci/.appium/node_modules/appium-device-farm/node_modules/express/lib/router/route.js:144:13)
    at Route.dispatch (/Users/ci/.appium/node_modules/appium-device-farm/node_modules/express/lib/router/route.js:114:3)
    at Layer.handle [as handle_request] (/Users/ci/.appium/node_modules/appium-device-farm/node_modules/express/lib/router/layer.js:95:5)
    at /Users/ci/.appium/node_modules/appium-device-farm/node_modules/express/lib/router/index.js:284:15
    at Function.process_params (/Users/ci/.appium/node_modules/appium-device-farm/node_modules/express/lib/router/index.js:346:12)
    at next (/Users/ci/.appium/node_modules/appium-device-farm/node_modules/express/lib/router/index.js:280:10)
    at /Users/ci/.appium/node_modules/appium-device-farm/lib/app.js:55:12
    at Generator.next (<anonymous>)
    at fulfilled (/Users/ci/.appium/node_modules/appium-device-farm/lib/app.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

The node will crash as it was not expecting error 500.

This PR rectify the issue and added the correct type to the method.

Copy link

vercel bot commented Nov 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
appium-device-farm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 7, 2023 8:31am

@afathonih afathonih changed the title Fix/device status change during device info Fix: node should send array of devices to hub Nov 7, 2023
@saikrishna321 saikrishna321 merged commit cb0d6e2 into AppiumTestDistribution:main Nov 7, 2023
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants