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

Posted

技术标签:

【中文标题】无服务器:服务文件未更改。跳过部署【英文标题】:Serverless: Service files not changed. Skipping deployment 【发布时间】:2019-01-11 15:57:13 【问题描述】:

在一些成功的项目之后,我删除了 AWS-lambda 中的函数,删除了 CloudWatch 中的日志和 IAM 角色。 还从我的文档中删除了my-service 文件夹。

然后我在无服务器中按照tutorial 中的步骤操作。

现在当我跑步时:

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】:

你试过了吗: serverless deploy --aws-profile testUser_atWork --force强制它更新堆栈?

否则,请尝试删除 cloudformation 中的堆栈,或使用serverless remove 命令

【讨论】:

请为您的回答提供更多解释。 是的,关键是 cloudformation。我必须从那里删除所有内容才能使用新功能进行更新,或者创建一个新的服务名称。

以上是关于无服务器:服务文件未更改。跳过部署的主要内容,如果未能解决你的问题,请参考以下文章