Closed harleenkbhatia closed 2 years ago
You will needs some sort of credentials to connect and send messages. Cognito is one of those options. Another is to use certificates downloaded from the AWS console. If you go through the 'connect one device' steps it will download the correct certificates and a script to setup and run the basic example. This script will run the sample with this command:
node node_modules/aws-iot-device-sdk/examples/device-example.js --host-name=${endpoint} --private-key=${thingName}.private.key --client-certificate=${thingName}.cert.pem --ca-certificate=root-CA.crt --client-id=${clientId}
If you are wanting to run this in a browser please take a look and our readme section browser-application and let me know if you still have any questions.
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Describe the issue
Please inform what is to be done after cloning and the npm install step? also I tried running the device-example.js by giving the actual awsConfigurations but I donot have pool ID so I commented it is it required? var awsConfiguration = { // poolId: YOUR_COGNITO_IDENTITY_POOL_ID_GOES_HERE, // 'YourCognitoIdentityPoolId' host: 'sampleendpoint', // 'YourAwsIoTEndpoint', e.g. 'prefix.iot.us-east-1.amazonaws.com' region: 'sample-region-1' // 'YourAwsRegion', e.g. 'us-east-1' };
but on running "node device-example.js" I get this error :
C:\Users\Hitech\THRSL\hello\aws-iot-device-sdk-js\device\index.js:446 throw new Error(exceptions.INVALID_CONNECT_OPTIONS); ^
Error: Invalid connect options supplied. at new DeviceClient (C:\Users\Hitech\THRSL\hello\aws-iot-device-sdk-js\device\index.js:446:13) at DeviceClient (C:\Users\Hitech\THRSL\hello\aws-iot-device-sdk-js\device\index.js:217:14) at processTest (C:\Users\Hitech\THRSL\hello\aws-iot-device-sdk-js\examples\device-example.js:33:19) at module.exports (C:\Users\Hitech\THRSL\hello\aws-iot-device-sdk-js\examples\lib\cmdline.js:208:4) at Object. (C:\Users\Hitech\THRSL\hello\aws-iot-device-sdk-js\examples\device-example.js:109:4)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
can you tell why is it not being able to connect ? and can you inform how to run this in a node free environment just using js, html, css??
Links
https://github.com/aws/aws-iot-device-sdk-js