Unbreakable
Unbreakable

Reputation: 8084

Size limit reached in AWS Lambda

I want to send data from AWS Lambda to Azure Service Bus Queue. Below is my attempt.

var azure = require("azure");

function test() {
  var serviceBusService = azure.createServiceBusService(
    "URL"
  );
  var message = {
    body: "Test message",
    customProperties: {
      testproperty: "TestValue"
    }
  };
  for (let i = 0; i < 10; i++) {
    serviceBusService.sendQueueMessage("myqueue", message, function(error) {
      if (!error) {
        console.log("message sent");
      }
    });
  }
}

test();

And it works fine in my local system

What I want - I want to put this code in AWS Lambda.

Error - When I upload it to Lambda I get error as "Could not find azure package".

Solution Attempted - I zipped my local folder container "node-modules" which has azure package and zipped it to upload but I am getting size Limit reached for Lambda exception as zip file is greater than 50 MB (lambda limit).

Upvotes: 1

Views: 238

Answers (1)

jarmod
jarmod

Reputation: 78583

The azure NPM package is a) deprecated and b) a rollup of all features so it's much larger than you strictly need. If you really want to continue to use this then consider using a subset of the package, specifically azure-arm-* or azure-*.

You should consider moving to the newer SDK, specifically the azure-arm-sb ServiceBus package. Note that it too will be deprecated next year, when MS migrates it fully to TypeScript.

Upvotes: 1

Related Questions