Cannot find module '/var/task/iot/core/attach/iot'

I created a Lambda function with version 1.30.0. It use AWS JavaScript SDK (version 2.291.0) and specifically IoT. I was able to deploy it to AWS. But while testing with Lambda console, I am getting the following error:

“errorMessage”: “Cannot find module ‘/var/task/iot/core/attach/iot’”,
“errorType”: “Error”,
“stackTrace”: [
“Function.Module._load (module.js:417:25)”,
“Module.require (module.js:497:17)”,
“require (internal/module.js:20:19)”

I really don’t know what to do next. Any leads?

I was able to resolve this bizarre issue. It was caused by some typo in my serverless.yaml.