aws-iot-device-sdk-js: ReferenceError: Map is not defined

The latest change has caused the SDK to cease working on my device due to the use of the ES6 Map type:

ERROR:    var activeSubscriptions = new Map();                                                                                                                                                    
   ERROR:                               ^                                                                                                                                                         
ERROR: ReferenceError: Map is not defined                                                                                                                                                         
    at new DeviceClient (/home/root/.node_app_slot/node_modules/aws-iot-device-sdk/device/index.js:232:34)                                                                                        
    at Object.DeviceClient [as device] (/home/root/.node_app_slot/node_modules/aws-iot-device-sdk/device/index.js:164:14)                                                                         
    at Object.<anonymous> (/home/root/.node_app_slot/main.js:11:21)                                                                                                                               
    at Module._compile (module.js:456:26)                                                                                                                                                         
    at Object.Module._extensions..js (module.js:474:10)                                                                                                                                           
    at Module.load (module.js:356:32)                                                                                                                                                             
    at Function.Module._load (module.js:312:12)                                                                                                                                                   
    at Function.Module.runMain (module.js:497:10)                                                                                                                                                 
    at startup (node.js:119:16)                                                                                                                                                                   
    at node.js:935:3     

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 25 (7 by maintainers)

Most upvoted comments

@jdelaune, yes you can install the previous version with ‘npm install aws-iot-device-sdk@1.0.10’. That version doesn’t include any ES6 types. These will be removed from the next release. Thanks for using AWS IoT.

Try npm install aws-iot-device-sdk@1.0.10

@jdelaune I haven’t tried other versions but due to the above issues I am currently using V1.0.5 in my project.

I too am having this problem, in fact in the AWS environment. I’m trying to write a NodeJS Lambda function to simulate data being pushed into the IoT environment. However, the version of NodeJS running in Lambda is 0.10.36, and thus it fails with the “ReferenceError: Map is not defined” error. Therefore, I’m interested in the update you refer to. Thanks.