vishnumanohar
vishnumanohar

Reputation: 713

AWS SAM On deployment apigateway says invalid permissions, works on clicking the arn and redploying

I am using AWS SAM to deploy a API gateway with Lambda proxy integration. when deployed the api gateway logs 'Invalid permission on lambda' but when I just click on the arn in integation request as shown below > save > redeploy then it works without any issue. wiered. any suggestions.

enter image description here

AccountPutMethod:
Type: AWS::ApiGateway::Method
Properties:
  AuthorizationType: COGNITO_USER_POOLS
  AuthorizerId: !Ref CognitoAuthorizer
  HttpMethod: PUT
  Integration:
    Type: AWS_PROXY
    IntegrationHttpMethod: POST
    Uri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${PutAccountFunction.Arn}/invocations"
  MethodResponses:
  - ResponseParameters:
      method.response.header.Access-Control-Allow-Origin: true
    StatusCode: '200'
  OperationName: putAccount
  ResourceId: !Ref AccountsResource
  RestApiId: !Ref LabBytesApi


PutAccountFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: ./src/app/accounts/put_account
      Policies:
      - arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess
      FunctionName: !Sub 'PutAccountFunction-${Environment}'
      Layers:
      - !Ref ViUtils
      Environment:
        Variables:
          Environment: !Ref Environment

Upvotes: 0

Views: 46

Answers (0)

Related Questions