TypeError: filesys.existsSync is not a function
See original GitHub issuei have written this code in angular 5 but when i compile this code @fengsongAWS
`import { Component } from ‘@angular/core’; import * as awsIot from “aws-iot-device-sdk”; import * as mqtt from “mqtt”; @Component({ selector: ‘app-root’, templateUrl: ‘./app.component.html’, styleUrls: [‘./app.component.css’] }) export class AppComponent { title = ‘app’; constructor(){
} device=new awsIot.device({ keyPath: “xxxxx”, certPath: “xxxxxxx”, caPath:“xxxxxx”, clientId: ‘mynodejs’, host: ‘xxxxxxxx’ }) }` i got error in browser ERROR TypeError: filesys.existsSync is not a function at module.exports (tls-reader.js:89) at new DeviceClient (index.js:455) at new AppComponent (app.component.ts:14) at createClass (core.js:12479) at createDirectiveInstance (core.js:12326) at createViewNodes (core.js:13784) at createRootView (core.js:13673) at callWithDebugContext (core.js:15098) at Object.debugCreateRootView [as createRootView] (core.js:14381) at ComponentFactory_.create (core.js:11278) how can i solve this issue ###
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:5

Top Related StackOverflow Question
The IoT SDK will not work out of the box as a Browser script because FileSystem is a system module and it’s not supported by a browser (duh!). You have to “browserify” the sdk by following the instructions there: https://github.com/aws/aws-iot-device-sdk-js#browser
Amazon really needs to update this old dinosaur… I have spent hours and hours and this aws-iot-device-sdk doesn’t work with any Angular version larger than 4. Really a shame…
ERROR in ./node_modules/aws-iot-device-sdk/common/lib/tls-reader.js Module not found: Error: Can’t resolve ‘fs’ in …
And this brakes the testing of Angular as well… I guess is time to move to GCP.