getting build errors while using aws-iot-device-sdk in reactjs application

Viewed 947

I am trying to use aws-iot-device-sdk js sdk in our reactjs application. I am getting below errors..

ERROR in ./~/aws-iot-device-sdk/common/lib/tls-reader.js Module not found: Error: Cannot resolve module 'fs' in /Users/xxxxx/react/aws-iot/node_modules/aws-iot-device-sdk/common/lib @ ./~/aws-iot-device-sdk/common/lib/tls-reader.js 17:16-29

ERROR in ./~/aws-iot-device-sdk/device/lib/tls.js Module not found: Error: Cannot resolve module 'tls' in /Users/xxxx/react/aws-iot/node_modules/aws-iot-device-sdk/device/lib @ ./~/aws-iot-device-sdk/device/lib/tls.js 17:10-24

How to get rid of these errors?

1 Answers

It's an old question. However, with ReactJS applications, generally with browser-based frontend applications, you should use the AWS JavaScript SDK. The documentation for the aws-iot-device-sdk states

These SDKs are for use on your IoT device. If you're developing an IoT app for use on a mobile device, see the AWS Mobile SDKs. If you're developing an IoT app or server-side program, see the AWS SDKs.

Related