我正在编写一些lambda,在这些lambda中,我使用aws sdk来使用某些服务,它对于某些服务工作正常,对于某些服务不工作,在某些服务中它表示模块初始化错误。这是怎么了,为什么有些aws sdk模块只会抛出此错误?
监视日志中的错误日志:
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
错误中的第4行是对象创建代码
const text = new AWS.Textract({apiVersion: '2018-06-27'});