AWS Lambda:The provided execution role does not have permissions to call DescribeNetworkInterfaces on EC2

前端 未结 6 1580
难免孤独
难免孤独 2021-02-06 21:17

Today I have a new AWS Lambda question, and can\'t find anywhere in Google.

I new a Lambda function, there is no question. But when I input any code in this function[eg.

6条回答
  •  自闭症患者
    2021-02-06 21:33

    It is definitely a strange error, but are you sure the example code you added is the one you're using in your lambda?

    Because in your code, you are trying to log something in your lambda after returning control via the callback. In other words, first you told your lambda that you're done. Next, while it is busy shutting down and returning your results, you try to do some logging...

    So first, I'd try this:

    exports.handler = (event, context, callback) => {
        console.log('this is a test');
        // do stuff
        callback(null, 'Hello from Lambda'); // only do a callback *after* you've run all your code
    };
    

    And see if that fixes the problem.

提交回复
热议问题