无服务器部署无法找到无服务器域管理器

时间:2020-01-23 13:19:17

标签: node.js amazon-web-services lambda deployment serverless

使用bitbucket管道在AWS上部署lambda时遇到以下错误

错误:无法设置基本路径映射。尝试先运行sls create_domain。

错误:在API网关中找不到“ staging-api.simple.touchsuite.com”。

ConfigError:配置中缺少区域

在getDomain.then.then.catch(/opt/atlassian/pipelines/agent/build/node_modules/serverless-domain-manager/index.js:181:15)

在runMicrotasksCallback(内部/进程/next_tick.js:121:5)
在_combinedTickCallback(内部/进程/next_tick.js:131:7)
在process._tickDomainCallback(internal / process / next_tick.js:218:9)

对于调试日志,请在设置环境变量“ SLS_DEBUG = *”之后再次运行。

获得支持
文件:docs.serverless.com 错误:github.com/serverless/serverless/issues 问题:forum.serverless.com

您的环境信息
作业系统:linux 节点版本:8.10.0
框架版本:1.61.3
插件版本:3.2.7
SDK版本:2.3.0
组件核心版本:1.1.2
组件CLI版本:1.4.0

因此,我将serverless-domain-manager更新为最新版本3.3.1

我在更新无服务器域管理器之后尝试部署lambda,现在出现以下错误。

无服务器错误

找不到无服务器插件“ serverless-domain-manager”。确保已安装它,并在无服务器配置文件的“插件”部分列出该文件。

serverless.yml代码段

plugins:
  - serverless-plugin-warmup
  - serverless-offline
  - serverless-log-forwarding
  - serverless-domain-manager

custom:
  warmup:
    schedule: 'cron(0/10 12-23 ? * MON-FRI *)'
    prewarm: true
  headers:
    - Content-Type
    - X-Amz-Date
    - Authorization
    - X-Api-Key
    - X-Amz-Security-Token
    - TS-Staging
    - x-tss-correlation-id
    - x-tss-application-id

  stage: ${opt:stage, self:provider.stage}
  domains:
    prod: api.simple.touchsuite.com
    staging: staging-api.simple.touchsuite.com
    dev: dev-api.simple.touchsuite.com
  customDomain:
    basePath: 'svc'
    domainName: ${self:custom.domains.${self:custom.stage}}
    stage: ${self:custom.stage}

bitbucket-pipeline.yml代码段

image: node:8.10.0

pipelines:
  branches:
    master:
      - step:
          caches:
            - node
          name: Run tests
          script:
            - npm install --global copy
            - npm install
            - NODE_ENV=test npm test
      - step:
          caches:
            - node
          name: Deploy to Staging
          deployment: staging   # set to test, staging or production
          script:
            - npm install --global copy
            - npm run deploy:staging
            - npm run deploy:integrations:staging
            - node -e 'require("./scripts/bitbucket.js").triggerPipeline()'

需要一些洞察力,我会错过哪些导致错误的信息

1 个答案:

答案 0 :(得分:1)

我发现使用Bitbucket时,我需要添加一个npm install命令,以确保在尝试运行它们之前,我的模块和插件都已安装。这可能是您所缺少的。您也可以为生成的node_modules文件夹打开缓存,这样就不必在每次部署时都下载所有模块。