serverless 如果同一事件类型的前缀重叠,则两个规则中不能有重叠的后缀
serverless Cannot have overlapping suffixes in two rules if the prefixes are overlapping for the same event type
我正在尝试使用无服务器框架部署 AWS Lambda,并在 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: #https://www.serverless.com/framework/docs/providers/aws/events/s3#using-existing-buckets
bucket: ${self:custom.bucket}
event: s3:ObjectCreated:*
rules:
- prefix: ${self:custom.path_prefix}/
- suffix: .json
existing: true
但是当我部署时出现以下错误
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).
知道我在这里做错了什么吗?
不知道 CloudWatch 日志中的详细信息 2021/08/30/[$LATEST]4f4f9ec564544ebb979576ed1b6b2879 (RequestId: 317ecd1c-b699-4799-8060-5168e1947e3c)
我会说在您的 AWS 帐户中已经有一个带有前缀 ${self:custom.path_prefix}/
和后缀 .json
的 S3 事件桶。我可能是因为以前的或其他无服务器堆栈,或者有人手动创建它并且没有删除它。
您能否通过 AWS 控制台检查 S3 上是否没有其他具有相同配置的事件?
我正在尝试使用无服务器框架部署 AWS Lambda,并在 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: #https://www.serverless.com/framework/docs/providers/aws/events/s3#using-existing-buckets
bucket: ${self:custom.bucket}
event: s3:ObjectCreated:*
rules:
- prefix: ${self:custom.path_prefix}/
- suffix: .json
existing: true
但是当我部署时出现以下错误
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).
知道我在这里做错了什么吗?
不知道 CloudWatch 日志中的详细信息 2021/08/30/[$LATEST]4f4f9ec564544ebb979576ed1b6b2879 (RequestId: 317ecd1c-b699-4799-8060-5168e1947e3c)
我会说在您的 AWS 帐户中已经有一个带有前缀 ${self:custom.path_prefix}/
和后缀 .json
的 S3 事件桶。我可能是因为以前的或其他无服务器堆栈,或者有人手动创建它并且没有删除它。
您能否通过 AWS 控制台检查 S3 上是否没有其他具有相同配置的事件?