Closed nickohold closed 1 year ago
+1 same here
+1
same
Hi @nickohold, thanks for reporting this. Could any of you (@nickohold, @Yurish-IL, @shavit-trop, @Avital-r) please run the code below and post the results here?. It is just to understand if the issue is with the deserialization of the response, or with the response that comes from the service itself.
import {DeviceFarmClient, ListDevicesCommand} from "@aws-sdk/client-device-farm";
import {NodeHttpHandler} from "@aws-sdk/node-http-handler";
class CustomHandler extends NodeHttpHandler {
async handle(request, {abortSignal}) {
const response = await super.handle(request, {abortSignal});
const body = response.response.body;
let data = "";
body.on('data', (chunk) => {
data += Buffer.from(chunk).toString()
});
body.on('end', () => {
console.log('Data: ', data);
});
return response;
}
}
const client = new DeviceFarmClient({
region: 'us-west-2',
requestHandler: new CustomHandler()
});
client.middlewareStack.add(next => args => {
console.log('Request: ', args.request);
return next(args);
}, {
step: "finalizeRequest"
});
client.send(new ListDevicesCommand({
filters: [
{
attribute: "FLEET_TYPE",
operator: "EQUALS",
values: [
"PRIVATE"
]
}
]
})).catch(console.log);
Note: Please make sure you redact any sensitive information, such as credentials.
Thanks!
Just a reminder for the folks on the thread. We monitor engagement based on reactions, you can use the 👍 reaction button instead of commenting +1.
Thanks, Ran~
Hi @RanVaknin. Here's the response of ListDevicesCommand:
Data: {"devices":[],"nextToken":"eyJpZCI6eyJzIjoiQkNDMEZDNzkzNEIyNDM1OEE1QjM1QzFGOTk5NjIyNUMvMTAwMDM4OSIsIm4iOm51bGwsImIiOm51bGwsIm0iOm51bGwsImwiOm51bGwsImJvb2wiOm51bGwsIm5zIjpudWxsLCJzcyI6bnVsbCwiYnMiOm51bGwsIm51bGwiOm51bGx9fQ=="}
@RanVaknin did you see my last response? I was wondering if you have any follow-up, we're really stuck on this, it's a crucial part of an automation run on the device farm, and basically nullifies the usage of the device farm.
Thank you!
@yenfryherrerafeliz Please see @nickohold 's reply
Hey folks, it turns out this is more of a pagination issue with the API than an SDK issue. The API is returning a valid response, as well as a next token, with the expectation for the user to use that next token regardless of the fact that zero devices were found on the first page. It appears that, when filtering devices, the desired filtered device can often be on the second or third page, and that the filter filters out all devices on the first page.
I am syncing with the Device Farm service team to determine next steps given this behavior.
@aristeia thanks for letting us know. I will close this as completed.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.
Checkboxes for prior research
Describe the bug
I have a project with private devices, which I've been using to manually schedule runs via the AWS platform, successfully. I also have a script to schedule runs programmatically, which works great for public devices. However, whenever I use a filter in ListDevicesCommand, like this:
[{"attribute": "FLEET_TYPE", "operator": "EQUALS", "values": ["PRIVATE"]}]
or in ScheduleRunCommand after using a hardcoded ARN of one of my private devices, as such:
I get 0 devices back.
Running the same command from the cli:
works as expected, and I get the private devices in the response.
The credentials used are the same (same credentials file), so it's not a permissions issue. The setup has been verified by an AWS device farm expert.
I am at a loss, and can't figure out what is wrong. I have followed the documentation to the tee.
SDK version number
@aws-sdk/client-device-farm@3.267.0 & 3.332.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v16.14.2
Reproduction Steps
Observed Behavior
Expected Behavior
Same functionality as the CLI: To get a list of the private devices we have under our project (4).
Possible Solution
No response
Additional Information/Context
No response