无服务器:服务文件未更改。跳过部署

19

在一些项目成功后,我删除了 AWS Lambda 中的功能,CloudWatch 中的日志以及 IAM 角色。同样从我的文档中删除了 my-service 文件夹。

然后我按照 Serverless 中这个教程中的步骤进行操作。

现在当我运行时:

serverless deploy --aws-profile testUser_atWork

testUser_atWork 是我在 AWS 中连接的个人资料之一。

我遇到了以下错误:

Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Service files not changed. Skipping deployment...
Service Information
service: my-service
stage: dev
region: us-east-1
stack: my-service-dev
api keys:
  None
endpoints:
  None
functions:
  hello: my-service-dev-hello




//serverless.yml

service: my-service

provider:
  name: aws
  runtime: nodejs6.10


functions:
  hello:
    handler: handler.hello

以下是我的handler.js代码:

'use strict';

module.exports.hello = (event, context, callback) => {
  const response = {
    statusCode: 200,
    body: JSON.stringify({
      message: 'Go Serverless v1.0! Your function executed successfully!',
      input: event,
    }),
  };

  callback(null, response);

  // Use this code if you don't use the http event with the LAMBDA-PROXY integration
  // callback(null, { message: 'Go Serverless v1.0! Your function executed successfully!', event });
};

我不明白为什么它跳过了部署。

1个回答

30

你是否尝试过使用serverless deploy --aws-profile testUser_atWork --force命令来强制更新堆栈?

否则,可以尝试在CloudFormation中删除堆栈或使用serverless remove命令进行删除。


请提供更多关于你的答案的解释。 - Rishikesh Raje
是的,关键在于CloudFormation。我必须从那里删除所有内容才能更新新功能,或创建一个新的服务名称。 - IgorAlves

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接