Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

514
Views
Test Lambda Locally (Lambda function calling another lambda function)

I am learning node and serverless architecture. To test my lambda function locally I am currently using lambda-local which has been working fine so far.

Now I have a function that invoke another lambda function, something like this:

    let lambda = new integration.myLambda.AWS.Lambda();
    let params = {
        FunctionName: 'my-other-function',
        InvocationType: 'RequestResponse',
        LogType: 'None',
        Payload: JSON.stringify(myEvent)
    };

    return new Promise((resolve, reject) => {

        lambda.invoke(params, function (error, data) {
            if (error) {
                console.log('error on invoke', error);
                reject({
                    statusCode: HttpStatus.INTERNAL_SERVER_ERROR,
                    message: error
                });

            } else {
                console.log('invoke success', data);
                resolve(JSON.parse(data.Payload));
            }
        });

    });

This bit of code does not work locally, but once deployed on aws it's working fine. However deploying to aws it takes about 2 mins. So I was wondering if there is a way to have this code run locally.

Any suggestions?

Thank you!

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

So personally I use serverless as my preferred framework for local, there's also a very promising looking project from atlassian called localstack here - I haven't actually tried the second one! Hope this helps.

over 4 years ago · Santiago Trujillo Report

0

So I find out that all I need it to do was to export: accessKeyId and secretAccessKey.

Just for testing put it in code just above your invoke call. Then make sure you set them in a secure place.

I was exporting them

export ACCESS_KEY_ID=yourkey

export SECRET_ACCESS_KEY=yoursecretkey

Now I am using docker so I have them in a config file.

Hope this helps

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!