question

Vipin Gahlaut avatar image
Vipin Gahlaut asked

Node.js terminating data in discovery response when data size is more than 8KB

Hi Experts,

We are Smart Switch Manufacturer and have integrated our switches with Alexa. We have implemented payload v3 in node.js. Everything works fine when number of switches are less than 16. However we have customers who have more than 20 switches and in near future we are expecting customers up to 50 switches installation.

When number of switches increases so does our discovery response. When debugged we found that when we have more than 20 switches our discovery response is terminated in the middle (nearly after 8309 bytes) and with incomplete data our json parsing fails.

Below is the code snippet.

var reqPost = https.request(optionspost, function(res) {
        res.on('data', function(d) {
            Console.log('Cloud Resp:', d);
            var jsonObj = JSON.parse(d);
        });
    }); 

We have console.log printed fine when data is less and it prints only partial data when data size is more than 8KB. We have captured the partial printed data and pasted it notepad. Size of notepad file with partial data is 8309 bytes.

what node.js limit is limiting the data size and how can we change those limits as we do not have control over node.js installation in lambda function

alexa smart homelambdanode_jsnodejs
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Vipin Gahlaut avatar image
Vipin Gahlaut answered
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.