我在使用无服务器框架时遇到一些问题,因为我不小心在另一个服务上使用了相同名称的服务。
An error occurred: tableX - TableX already exists.
假设我有两个“ serverless.yml ”文件,两个文件的服务名称相同。其中一个(我们称其为“ test1 ”)具有资源(DynamoDB表),而另一个则没有(“ test2 ”)。像以下片段一样:
测试1
service: sandbox-core
provider:
name: aws
stage: core
runtime: nodejs6.10
region: sa-east-1
memorySize: 128
timeout: 300
resources:
Resources:
table3:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
TableName: SandboxTable3
AttributeDefinitions:
-
AttributeName: provider
AttributeType: S
-
AttributeName: appId
AttributeType: S
KeySchema:
-
AttributeName: provider
KeyType: HASH
-
AttributeName: appId
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
table4:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
TableName: SandboxTable4
AttributeDefinitions:
-
AttributeName: …Run Code Online (Sandbox Code Playgroud) amazon-web-services aws-cloudformation amazon-dynamodb serverless-framework serverless
serverless ×1