title: AWS Lambda node-soap function (serverless framework)
body: <p>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 (using serverless framework, but also executed directly in AWS lambda), it doesn’t appear to create the soap client.</p>
  
  <p>Any thoughts on why this might be happening?</p>
  
  <pre><code>export async function main(event, context) {
      var soap = require('soap');
      var url = 'https://service.blah.co.uk/Service/Function.asmx?wsdl';
  
      var soapOptions = {
          forceSoap12Headers: true
      };
  
      var soapHeader = {
          'SOAPAction': 'http://www.blah.co.uk/Services/GetToken'
      };
  
      var params = {
          xmlMessage: message
      };
  
      console.log(JSON.stringify(params));
  
      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.addSoapHeader(soapHeader);
          client.GetToken(params, function (err, data) {
              console.log(data);
          });
      });
  }
  </code></pre>