An error occurred: XXXLambdaFunction - Unable to retrieve TopicName attribute for AWS::SNS::Topic, with error message Rate exceeded

0

I am trying to deploy my lambdas to AWS, but getting this error.

An error occurred: AssignOrderLambdaFunction - Unable to retrieve TopicName attribute for AWS::SNS::Topic, with error message Rate exceeded (Service: Sns, Status Code: 400, Request ID: 79f1648a-90e0-5ebf-bb34-3f0993f6ca08).

I did not change anything in the serverless.yml. I have used this serverless.yml for over two years and have had no issues. Please help if you have any info about this error. BTW I am not an AWS expert, just using it :slight_smile:

Here are some details:

I am using Lambda with NodeJs (Typescript) Using SNS and SQS to pass events across my services. My serverless.yml structure:

     service:
      name: myService
    
    provider:
      name: aws
      runtime: nodejs14.x
      memorySize: 1024
      region: us-west-1
    
      tracing:
          apiGateway: true
          lambda: true
    
      excludeDevDependencies: true
    
      iamRoleStatements:
          - Effect: Allow
            Action:
                - sns:Publish
            Resource:
                - Fn::Join:
                      - ''
                      - - 'arn:aws:sns:'
                        - Ref: AWS::Region
                        - ':'
                        - Ref: AWS::AccountId
                        - ':'
                        - Fn::GetAtt:
                              - orderPaidTopic
                              - TopicName
    
      environment:
        ORDER_PAID_TOPIC: ${self:custom.topicsArn.orderPaid}
    
    custom:
      topics:
          orderPaid: ${self:service.name}-orderPaid-${self:custom.stage}
    
      topicsArn:
          orderPaid:
              Fn::Join:
                  - ''
                  - - 'arn:aws:sns:'
                    - Ref: AWS::Region
                    - ':'
                    - Ref: AWS::AccountId
                    - ':'
                    - Fn::GetAtt:
                          - orderPaidTopic
                          - TopicName
    
      awsAccountId: ${ssm:${self:custom.stage}.aws.accountId~true}
    
      acmCertificateName: ${ssm:${self:custom.stage}.domains.api.acm~true}
    
      awsLambdaAuthorizer: ${ssm:${self:custom.stage}.aws.lambda.authorizer~true}
    
    resources:
      Resources:
          orderPaidTopic:
              Type: AWS::SNS::Topic
              Properties:
                  TopicName: ${self:custom.topics.orderPaid}
1 Answer
1

"Rate exceeded" is one of the possible throttling errors where your API request rate has exceeded a limit. The standard way to handle this is to retry with exponential backoff. AWS SDKs handle some of this for you, retrying API calls rejected due to throttling and retrying with exponential backoff up to a retry limit. The Python Boto3 SDK for example allows you to configure the retry mode & number of retries, but I'm not familiar with the NodeJS one.

Unfortunately documentation about throttling across different APIs is a bit patchy, as is coverage of throttling activity by CloudWatch Metrics. I confirmed all this through AWS Support recently, and it was a bit disappointing. You may be able to get some visibility via "ThrottleCount" and "RequestLimitExceeded" metrics in Cloudwatch but

  • Support confirmed that not all services that have API throttling generate these (yet).

  • I think only metrics that have generated data (i.e. a throttling event has happened) appear here, from what I've seen, so there's no way to inventory what ones can occur.

  • Until I got the EC2/API metric enabled by requesting Support, EC2 API throttling wasn't visible in Cloudwatch Metrics. Support said there's no similar situation for other APIs.

EXPERT
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions