Cannot have overlapping suffixes in two rules if the prefixes are overlapping for the same event type

I am trying to deploy AWS Lambda using Serverless framework and have following in serverless.yaml

provider:
  name: aws
  runtime: python3.8
  region: us-west-2
  stackName: ${self:service}-${self:custom.name}-${opt:stage, 'dev'}
  stackTags:
    Service: "it"
  lambdaHashingVersion: 20201221
  memorySize: 128
  timeout: 900
  logRetentionInDays: 14
  disableDefaultOutputExportNames: true
  deploymentBucket: ${self:custom.deployment-s3-bucket}
  environment:
    S3_BUCKET: ${self:custom.bucket}
    S3_BUCKET_PATH_PREFIX: ${self:custom.path_prefix}
    REDSHIFT_DATABASE: ${self:custom.database}
    REDSHIFT_SCHEMA: ${self:custom.schema}
    REDSHIFT_TABEL_PREFIX: ${self:custom.table_prefix}
    REDSHIFT_USER: ${self:custom.user}
    REDSHIFT_PASSWORD: ${self:custom.password}
    REDSHIFT_PORT: ${self:custom.port}
    REDSHIFT_ENDPOINT: ${self:custom.endpoint}
    REDSHIFT_ROLE: ${self:custom.role}
  iam:
    role:
      name: s3-to-redshift-load
      statements:
        - Effect: Allow
          Action:
            - s3:GetObject
          Resource: "arn:aws:s3:::${self:custom.bucket}/*"

functions:
  load:
    handler: handler.run
    events:
      - s3:
          bucket: ${self:custom.bucket}
          event: s3:ObjectCreated:*
          rules:
            - prefix: ${self:custom.path_prefix}/
            - suffix: .json
          existing: true

But when I deploy I get following error

Serverless Error ----------------------------------------

  An error occurred: LoadCustomS31 - Received response status [FAILED] from custom resource. Message returned: Configuration is ambiguously defined. Cannot have overlapping suffixes in two rules if the prefixes are overlapping for the same event type. See details in CloudWatch Log: 2021/08/30/[$LATEST]4f4f9ec564544ebb979576ed1b6b2879 (RequestId: 317ecd1c-b699-4799-8060-5168e1947e3c).

any idea what wrong I am doing here ? This deployment was working before with previous version, when I upgraded to 2.54.0 I started experiencing this.

Probably not relevant by now, but I encountered the same issue so I might be relevant to others.

AWS doesn’t support multiple overlapping triggers for different lambdas. This means that you cannot create a trigger of “/my/path” twice for the same bucket and direct it to two lambdas (or “/my/path” and “/my/path/folder” to different lambdas).
This can be reproduced using the aws console, using the properties tab → Event notificationsCreate event notification

The solution I used is to make the bucket notify a SNS message, which in turn,. triggers the lambda (and doesn’t have the same limitation)/