3

I am using serveless + aws + node.js.

I have a lambda calling another lambda. I can't get to run the lot locally. I can invoke both lambdas locally with 'serverless invoke local -f ...' BUT
the caller one comes back with:

{"message":"Function not found: arn:aws:lambda:eu-west-1:5701xxxxxxxxxx:function:the-right-function-name"}

as if the caller function invoked the callee on AWS and not locally.

Is there anyway to do stay local and if yes, what may I be missing?

1 Answer 1

1

You can achieve that with this plugin. There is a feature of AWS SDK for Lambda that allows you to override the API endpoint of Lambda service. Therefore you can set it to localhost.

const AWS = require('aws-sdk');

const endpoint = process.env.SERVERLESS_SIMULATE ?
  process.env.SERVERLESS_SIMULATE_LAMBDA_ENDPOINT :
  undefined

const lambda = new AWS.Lambda({ endpoint })

For more details, refer to the plugin's readme. Also there is a nice article about that.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.