AWS Lambda 达到大小限制
Size limit reached in AWS Lambda
我想将数据从 AWS Lambda 发送到 Azure 服务总线队列。以下是我的尝试。
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();
它在我的本地系统中运行良好
我想要什么 - 我想把这段代码放在 AWS Lambda 中。
Error - 当我将它上传到 Lambda 时,出现 "Could not find azure package"
.
错误
已尝试解决方案 - 我压缩了我的本地文件夹容器 "node-modules",其中包含 azure 包 并将其压缩以上传,但我由于 zip 文件大于 50 MB(lambda 限制),我收到了 Lambda 异常的大小限制。
azure NPM 包 a) 已弃用 b) 所有功能的汇总,因此它比您严格需要的要大得多。如果你真的想继续使用这个然后考虑使用包的一个子集,特别是 azure-arm-*
或 azure-*
.
您应该考虑转向 newer SDK, specifically the azure-arm-sb ServiceBus 包。请注意,明年当 MS 将其完全迁移到 TypeScript 时,它也将被弃用。
我想将数据从 AWS Lambda 发送到 Azure 服务总线队列。以下是我的尝试。
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();
它在我的本地系统中运行良好
我想要什么 - 我想把这段代码放在 AWS Lambda 中。
Error - 当我将它上传到 Lambda 时,出现 "Could not find azure package"
.
已尝试解决方案 - 我压缩了我的本地文件夹容器 "node-modules",其中包含 azure 包 并将其压缩以上传,但我由于 zip 文件大于 50 MB(lambda 限制),我收到了 Lambda 异常的大小限制。
azure NPM 包 a) 已弃用 b) 所有功能的汇总,因此它比您严格需要的要大得多。如果你真的想继续使用这个然后考虑使用包的一个子集,特别是 azure-arm-*
或 azure-*
.
您应该考虑转向 newer SDK, specifically the azure-arm-sb ServiceBus 包。请注意,明年当 MS 将其完全迁移到 TypeScript 时,它也将被弃用。