SOAP AWS Lambda function

I am testing a call to a SOAP service using node-soap library.
This works fine as a standalone node.js app and the SOAP service responds, however when I package the same code up as a serverless AWS lambda function, it doesn’t appear to create the soap client.

Any thoughts on why this might be happening?

export async function main(event, context) {
    var soap = require('soap');

    var url = '';

    var soapOptions = {
    forceSoap12Headers: true

    var soapHeader = {

    'SOAPAction': ''


    var params = {

    xmlMessage: message



    soap.createClient(url, soapOptions, function (err, client) {

    //the serverless AWS lambda function never reaches this point (deployed and invoked locally)

    console.log("In create client")
    if (err) console.log(err);


    client.GetToken(params, function (err, data) {




The issue was the use of async. The async keyword executes asynchronously and will return a Promise. Since it’s an asynchronous function, the Lambda is being terminated before it could actually execute the callback. (Credit goes to help on