无服务器:指定的存储桶不存在

Serverless: The specified bucket does not exist

我愚蠢地删除了我的无服务器项目的 s3 存储桶。当我现在尝试部署或删除我的应用程序时,出现此错误:The specified bucket does not exist 如何从无服务器重新创建 s3 存储桶?

我需要从云形成中删除堆栈,完成后我能够重新运行 成功部署无服务器。

是的,无服务器只能那样工作。当您删除 s3 存储桶时,它并未从堆栈条目中删除,因此它失败了。如果我们要删除 S3 存储桶,我们也应该从中删除 Stack 条目。通过错误处理,我们还可以检查存储桶是否存在。

生产环境使用这个插件

https://www.serverless.com/plugins/serverless-deployment-bucket

并设置桶。如果它不存在,它将创建。

provider:
    name: aws
    region: us-east-1
    runtime: provided.al2
    stackName: buggy
    deploymentBucket:
        name: buggy-deploymentbucket

plugins:
  - serverless-deployment-bucket