Search code examples
amazon-web-servicesaws-lambdaserverlessserverless-framework

Not authorized to perform: lambda:GetFunction


I am trying to deploy lambda function with Serverless framework I've added my ADMIN credentials in the aws cli and I am getting this error message every time I try to deploy

Warning: Not authorized to perform: lambda:GetFunction for at least one of the lambda functions. Deployment will not be skipped even if service files did not change.

Error: CREATE_FAILED: HelloLambdaFunction (AWS::Lambda::Function) Resource handler returned message: "null (Service: Lambda, Status Code: 403, Request ID: ********)" (RequestToken: ********, HandlerErrorCode: GeneralServiceException)

I've also removed everything from my project and from the YML file and nothing worked

service: test
frameworkVersion: '3'
provider:   
  name: aws
  runtime: nodejs12.x
  iam:
    role:
      statements:
        - Effect: "Allow"
          Action:
            - lambda:*
            - lambda:InvokeFunction
            - lambda:GetFunction
            - lambda:GetFunctionConfiguration
          Resource: "*"

functions:
  hello:
    handler: handler.hello

Solution

  • When I tried to create a lambda function manually from the AWS website I found that I've no permission to view or create any lambda function And after that I found that my account was suspended due to a behavior I've done that is not acceptable in AWS policy I've followed the steps the support has sent me and then my account was back and everything worked fine