...
exports.handler = function(event, context, callback) {
context.callbackWaitsForEmptyEventLoop = false; //keeps mongoose connection active
/*
init values
*/
var a = event.a,
b = event.b,
c = event.c,
d = event.d,
e = event.e;
var output = {
//TODO look into SSMS
dialogAction: {
type: "Close",
fulfillmentState: "Fulfilled",
message: {
contentType: "PlainText",
content: "Record for " + a + " successfully updated."
}
}
}; //output
// Use connect method to connect to the server
console.log(event);
MongoClient.connect(url, function(err, client) {
assert.equal(null, err);
console.log("Connected successfully to server");
const db = client.db(dbName);
const collection = db.collection("a");
collection.updateOne(
{ a: a },
{ $set: { b: b } },
{ $set: { c: c } },
{ $set: { d: d } },
{ $set: { e: e } },
function(err, result) {
assert.equal(err, null);
assert.equal(1, result.result.n);
console.log("Updated the document for " + a);
callback(result);
}
);
});
};
...
lambda-local -l index.js -h handler -e holiq.js
В holiq.js нет ошибок
вывод события правильно и mongodb успешно подключились, но
ошибка: конец - ошибка:
error: {
"errorMessage": "Task timed out after 5.00 seconds",
"errorType": "TimeoutError",
"stackTrace": [
"Context.<anonymous> (/usr/local/lib/node_modules/lambda-local/lib/context.js:127:9)",
"ontimeout (timers.js:436:11)",
"tryOnTimeout (timers.js:300:5)",
"listOnTimeout (timers.js:263:5)",
"Timer.processTimers (timers.js:223:10)"
]
}
произошла ошибка тайм-аута
Пожалуйста, помогите мне! ~