UNPKG

serverless

Version:

Serverless Framework - Build web, mobile and IoT applications with serverless architectures using AWS Lambda, Azure Functions, Google CloudFunctions & more

37 lines (29 loc) 808 B
'use strict'; module.exports.withErrorByDone = (event, context) => { context.done(new Error('failed')); }; module.exports.withMessageByReturn = () => 'Succeed'; module.exports.withMessageByDone = (event, context) => { context.done(null, 'Succeed'); }; module.exports.withMessageByLambdaProxy = (event, context) => { context.done(null, { statusCode: 200, headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ result: true, message: 'Whatever', }), }); }; module.exports.withRemainingTime = (event, context) => { const start = context.getRemainingTimeInMillis(); const stopAt = new Date().getTime() + 1; while (new Date().getTime() < stopAt); context.done(null, { start, stop: context.getRemainingTimeInMillis(), }); };