trying to soap request from lambda handler but getting Cannot read properties of undefined (reading 'create')
below is my lambda handler
'use strict';
const soap = require('soap');
module.exports.handler = async (event, context) => {
const url = 'http://www.thomas-bayer.com/axis2/services/BLZService?wsdl';
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0
const client = await soap.createClientAsync(url)
console.log(client)
return {
statusCode: 200,
message: 'It works!'
}
}
Error
2022-10-18T17:49:49.403Z 5cace584-2e89-4cb2-99d0-b8b7ba7991a6 ERROR Invoke Error {"errorType":"TypeError","errorMessage":"Cannot read properties of undefined (reading 'create')","stack":["TypeError: Cannot read properties of undefined (reading 'create')"," at new HttpClient (/var/task/node_modules/soap/lib/http.js:40:59)"," at Object.open_wsdl (/var/task/node_modules/soap/lib/wsdl/index.js:1270:48)"," at openWsdl (/var/task/node_modules/soap/lib/soap.js:70:16)"," at /var/task/node_modules/soap/lib/soap.js:48:13"," at _requestWSDL (/var/task/node_modules/soap/lib/soap.js:76:9)"," at createClient (/var/task/node_modules/soap/lib/soap.js:94:5)"," at /var/task/node_modules/soap/lib/soap.js:104:9"," at new Promise (<anonymous>)"," at Object.createClientAsync (/var/task/node_modules/soap/lib/soap.js:103:12)"," at Runtime.module.exports.handler (/var/task/soap.js:7:31)"]}
Using soap npm module, not sure where i am going wrong, need your help.