Unsupported object format when using Fn::FindInMap

How can I get the code below to work? I haven’t been able to find any information on the error.

service: SomeService
variablesResolutionMode: 20210326
configValidationMode: warn

functions:
  share:
    environment:
      SIMPLE_EMAIL_SERVICE_REGION:
        Fn::FindInMap: [ClosestSESRegion, Ref: 'AWS::Region', SESRegion]

resources:
  Mappings:
    ClosestSESRegion:
      us-east-1:
        SESRegion: us-east-1
      us-west-1:
        SESRegion: us-west-2
      us-west-2:
        SESRegion: us-west-2
      eu-west-1:
        SESRegion: eu-west-1
      eu-west-2:
        SESRegion: eu-west-2
      ap-northeast-1:
        SESRegion: us-east-1
      ap-northeast-2:
        SESRegion: us-west-2
      ap-southeast-1:
        SESRegion: us-west-2
      ap-southeast-2:
        SESRegion: us-west-2
      ap-south-1:
        SESRegion: us-west-2
      us-east-2:
        SESRegion: us-east-1
      sa-east-1:
        SESRegion: us-west-2
      eu-central-1:
        SESRegion: eu-west-1

Error:


Serverless: Configuration warning at 'functions.share.environment.SIMPLE_EMAIL_SERVICE_REGION': unsupported object format
1 Like