-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Use Node.js to call Google API and put it into a cloud function. client method cannot return data #1584
Comments
Hi @radianceltd, thank you for the detailed bug report. Unfortunately, this issue tracker has limited visibility and scope - basically, it's just for reporting issues with the samples contained here and is only watched by the folks who work on these samples. We are happy to help you move this bug to venues where it'll get the attention of the appropriate product teams.
I'm going to close this issue because the folks who own this repo have no actionable way to resolve it directly, but please let us know if there's anything we can do to help! |
@fhinkel Thank you for your reply, would you like to inquire whether Google has restricted Chinese computers from reading data through VPN nodes? |
`exports.devicegetway = async (req,res) => {
}
const getClient = async (serviceAccountJson,res) => {
const authClient = await google.auth.getClient({
keyFilename: serviceAccountJson,
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
});
const discoveryUrl = 'https://cloudiot.googleapis.com/v1/projects/riltmw025tool-2019/locations/us-central1/registries/my-registry/devices';
google.options({
auth: authClient,
});
try {
return google.discoverAPI(discoveryUrl);
} catch (err) {
console.error('Error during API discovery.', err);
}
};
const listDevicesForGateway = async (client,projectId,cloudRegion,registryId,gatewayId) => {
const parentName =
projects/${projectId}/locations/${cloudRegion}/registries/${registryId}
;const request = {
parent: parentName,
'gatewayListOptions.associationsGatewayId': gatewayId,
};
let devices;
try {
const {data} = await client.projects.locations.registries.devices.list(
request
);
devices = data.devices;
} catch (err) {
console.error('Could not list devices', err);
return;
}
console.log('Current devices bound to gateway: ', gatewayId);
if (devices && devices.length > 0) {
devices.forEach(device => {
console.log(
\tDevice: ${device.numId} : ${device.id}
);});
} else {
console.log('No devices bound to this gateway.');
}
};
`
const {data} = await client.projects.locations.registries.devices.lis cannot return data
I try to use const client = new iot.v1.DeviceManagerClient to get only part of the API function data
IAM and service account / valid key are both stored in the project file, but this problem never returns to me
The text was updated successfully, but these errors were encountered: