I'm trying to ListProjects in AWS Device Farm.
Here's my code:
const AWS = require('aws-sdk');
AWS.config.update({ region:'us-east-1' });
const credentials = new AWS.SharedIniFileCredentials({ profile: '***' });
AWS.config.credentials = credentials;
const devicefarm = new AWS.DeviceFarm();
async function run() {
let projects = await devicefarm.listProjects().promise();
console.log(projects);
}
run();
I'm getting this error:
UnknownEndpoint: Inaccessible host:
devicefarm.us-east-1.amazonaws.com'.
This service may not be available in the `us-east-1' region.
According to http://docs.amazonaws.cn/en_us/general/latest/gr/rande.html, Device Farm is only available in us-west-2
?
Changing AWS.config.update({ region:'us-east-1' });
to AWS.config.update({ region:'us-west-2' });
worked:
Working code:
const AWS = require('aws-sdk');
AWS.config.update({ region:'us-west-2' });
var credentials = new AWS.SharedIniFileCredentials({ profile: '***' });
AWS.config.credentials = credentials;
var devicefarm = new AWS.DeviceFarm();
async function run() {
let projects = await devicefarm.listProjects().promise();
console.log(projects);
}
run();