I have this code on my node.js server (Google's App Engine):
const formattedName = iotClient.devicePath(projectId, cloudRegion, registryId, numSerie)
const binaryData = Buffer.from(command);
const request = {
name: formattedName,
binaryData: binaryData,
};
try {
const responses = await iotClient.sendCommandToDevice(request);
res.send(responses[0])
} catch (err) {
res.send(err)
}
}
And this on my front end (angular 9 - GET):
this.httpClient.get('https://XXXXXXXX.appspot.com/?numSerie=' + 'DOCID' + '&proyecto=XXXX®istro=XXXX®ion=XXXX&command=' + JSON.stringify(jsonEnviar));
Everthing works perfect if I send commands as numbers, 1-20, for example. However if I want to send a JSON it fails, my device won't get the command. Any idea why?