Error message when updating Lambda runtime

0

Hello, I am trying to update a function in AWS Lambda from node.js 16 to node.js 20, but I kept receiving the following error message: The role defined by this function cannot be assumed by Lambda.

This is how I attempted to update the runtime version:

  1. select the specific function in Lambda;
  2. scroll down to "Runtime settings" and click on the "Edit" button;
  3. select from the runtime dropdown list "Node.js 20.x";
  4. click "Save". After these actions, I received the error message: "The role defined by this function cannot be assumed by Lambda".

Please kindly advise how I may resolve this. Thank you so much!

질문됨 5달 전389회 조회
1개 답변
0

Hello.

I feel like there's a problem with the IAM role I'm using with Lamabda.
Is the following trust policy set for the IAM role used by Lambda?
Also, how are you updating the Lambda runtime version?

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "lambda.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}
profile picture
전문가
답변함 5달 전
profile pictureAWS
전문가
검토됨 5달 전
  • Thank you for the reply. I tried using both root user and IAM user to update the runtime version, but received the same error message. This is how I attempted to update runtime:

    1. select the specific function in Lambda;
    2. scroll down to "Runtime settings" and click on the "Edit" button;
    3. select from the runtime dropdown list "Node.js 20.x";
    4. click "Save". After these actions, I received the error message: The role defined by this function cannot be assumed by Lambda. May I know where I should put the above code you shared, please? Thank you!
  • Thank you for confirmation. I tried upgrading in the same way in my environment, but the error could not be reproduced.

    May I know where I should put the above code you shared, please?

    This is what is set in the trust policy of the IAM role used by Lambda. You can check the IAM role set from Lambda settings. a

    Once you open the IAM role, check the trust policy. b

  • Thank you so much for providing the above guidance! Really appreciate it. I followed the above steps and realised that the corresponding role cannot be found. i.e., I clicked on "Configuration", followed by "Permissions". Under the "Execution role", it shows the "Role name" and then the "Resource summary". The "Resource summary" currently indicates that the role cannot be found. May I know what does this imply, please? Thank you!

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠