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.

Premature Close when using Devices

See original GitHub issue

I’m a little new to using AWS IoT, so I was going through the examples trying to get a basic device communicating, but I keep getting a Premature Close error and I can’t really pinpoint why this is happening.

My code is as follows: const device = awsIot.device({ keyPath: '<full path>/21e89ffb9e-private.pem.key', certPath: '<full path>/21e89ffb9e-certificate.pem.crt', caPath: '<full path>/rds-ca-2015-root.pem', clientId: 'Database_Handler', host: 'a30u0mm8b3ldbd-ats.iot.us-east-2.amazonaws.com' }); And the error I keep getting is: Error: premature close at onclosenexttick (<full path>/node_modules/end-of-stream/index.js:54:86) at processTicksAndRejections (internal/process/task_queues.js:79:11) Emitted 'error' event on DeviceClient instance at: at MqttClient.<anonymous> (<full path>/node_modules/aws-iot-device-sdk/deviceindex.js:772:15) at MqttClient.emit (events.js:333:22) at TLSSocket.f (<full path>/node_modules/once/once.js:25:25) at onclosenexttick (<full path>/node_modules/end-of-stream/index.js:54:73) at processTicksAndRejections (internal/process/task_queues.js:79:11) This is taken pretty much directly from the device-example.js file in the repository, the only significant difference is that I’m not using the command line process, but from what I understood that was something that could be omitted.

I noticed an Issue with the same problem that was closed, but there wasn’t a solution in the thread, so I was hoping to get some clarification here by opening a new one. Thank you for the help.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
rabidaudiocommented, Apr 3, 2020

I had this issue, and it turned out I had forgotten to attach a policy to the certificate.

1reaction
borch84commented, Nov 18, 2020

I am getting the same error. The policy is attached to my certificate. I execute the process and it connects to AWS IoT and it remains like this for at least a week and it suddenly disconnects.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to solve: premature close at onclosenexttick in Node.js ...
I was using single clientId for multiple devices, my device locally, my co-worker, the EC2 instance. SO the conflict was there. To solve...
Read more >
Closing PDA in premature infants – without surgery
“We currently have two device options for PDA device closure in extremely premature babies,” Dr. Reddy says. “We started the program with the...
Read more >
Premature Closure of Foramen Ovale | JAMA Pediatrics
Premature closure of the foramen ovale is a rare cause of the hypoplastic left heart syndrome. Although a number of cases have been...
Read more >
Transcatheter Closure of Patent Ductus Arteriosus in ... - NCBI
Transcatheter PDA closure in symptomatic premature infants is feasible using currently available devices; moreover, the procedure serves as an ...
Read more >
Patent Ductus Arteriosus (PDA) - Children's Hospital Colorado
Non-Surgical Patent Ductus Arteriosus (PDA) Closure for Premature Babies ... closure: Doctors can insert a soft, wire mesh PDA closure device through a ......
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