question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: filesys.existsSync is not a function

See original GitHub issue

i 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:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:5

github_iconTop GitHub Comments

2reactions
typenaicommented, Jun 10, 2019

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

0reactions
agabardocommented, May 1, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: filesys.existsSync is not a function #76
This method is the exposed module; it validates and prepares the tls · options as required for connection to the AWS IoT service....
Read more >
Uncaught TypeError: filesys.existsSync is not a function
When trying to initialize IOT device using AWS IoT SDK for JavaScript, its giving error. TypeError: filesys.
Read more >
TypeError: fs.existsSync is not a function - DEV Community ‍ ‍
While using Sass in a react project and using useRef hook, one might come across this error: React and Sass error.
Read more >
File system | Node.js v19.3.0 Documentation
All file system operations have synchronous, callback, and promise-based forms, ... If a <FileHandle> is not closed using the filehandle.close() method, ...
Read more >
Node.js fs.existsSync() Method - GeeksforGeeks
The fs.existsSync() method is used to synchronously check if a file already exists in the given path or not. It returns a boolean...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found