nordcloud/lambda-wrapper

Integration to serverless-offline

Aciid opened this issue · 2 comments

Aciid commented

Hey,

Just to let you know I've been in talks with @dherault about serverless-offline and there seems to be potential to integrate lambda-wrapper and a wrapper for online invokation under one general function that keeps an eye on env.IS_OFFLINE variable.

I've outlined your project briefly here, after I was looking for answers to this.
dherault/serverless-offline#55

Now it's just a case of having a if statement in the invokation chain , but it's a rather heavylifting to code everything twice in where you call the lambda functions so that it can call any which one depending are we online or offline.

Aciid commented

Hi,

Seems that there is actually nothing other than "IS_OFFLINE" to check for. Works as designed thanks.
What kind of a qualifier is used for deployed lambda function name? full with ARN ?

here where "myFunctionName" should it be like
myFunctionName
aws-nodejs-dev-myFunctionName
arn:aws:lambda:eu-central-1:1234567890:function:aws-nodejs-dev-myFunctionName

var lambda = require('lambda-wrapper').wrap({
    region: 'eu-west-1',
    lambdaFunction: 'myFunctionName'
});

Thanks

@Aciid sorry for the extremely long delay. The function uses the function name, i.e. in your case that would be 'myFunctionName'. For cases that would test against the endpoints provided by serverless-offline, I'd rather go with an implementation using e.g. the Node.js request library instead of lambda-wrapper.