I am writing some lambda's and In those lambda's I am using aws sdk to use some of the services, It's working fine for some service and it's not working for some services, in some services it say's module initialization error. What is wrong here, why some aws sdk modules only throw this error?
the error log from watch log:
START RequestId: dcbf2a88-d723-4a4e-8be9-896887150169 Version: $LATEST
module initialization error: TypeError
at Object.<anonymous> (/var/task/src/functions/routes/handler.js:4:18)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
END RequestId: dcbf2a88-d723-4a4e-8be9-896887150169
REPORT RequestId: dcbf2a88-d723-4a4e-8be9-896887150169 Duration: 38.90 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 69 MB
line number 4 in the error is object creation code
const text = new AWS.Textract({apiVersion: '2018-06-27'});