I'm trying to send my GCP IoT device a new configuration. The Base64-encoded binary string is approximately 15k bytes in length. GCP IoT device config size limit is 64k according to the docs. But I'm still getting a 413 (request entity too large) error. What am I doing wrong? 15k seems incredibly tiny to be producing such an error. Thanks for any help.
Here's the JavaScript code that sends the config data:
sendDeviceConfig(deviceId, configPayload) {
const parentName = `projects/${this.projectId}/locations/${this.cloudRegion}`;
const registryName = `${parentName}/registries/${this.registryId}`;
const binaryData = Buffer.from(configPayload).toString('base64');
const request = {
name: `${registryName}/devices/${deviceId}`,
versionToUpdate: 0,
binaryData: binaryData,
};
return new Promise((resolve, reject)=>{
this.client.projects.locations.registries.devices.modifyCloudToDeviceConfig(
request,
(err) => {
if (err) {
this.logger.error('Could not update config:', deviceId);
reject(err);
} else {
resolve();
}
}
);
});
}
... And part of the HTML formatted (wtf?) error response:
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 413 (Request Entity Too Large)!!1</title>
...
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>413.</b> <ins>That’s an error.</ins>
<p>Your client issued a request that was too large.