【问题标题】:serverless-domain-manager cannot be found by serverless deployment无服务器部署找不到无服务器域管理器
【发布时间】:2020-05-09 18:48:18
【问题描述】:

使用 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 (internal/process/next_tick.js:121:5)
在 _combinedTickCallback (internal/process/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

我尝试在更新 serverless-domain-manager 后部署 lambda,但现在出现以下错误。

无服务器错误

未找到无服务器插件“无服务器域管理器”。确保它已安装并列在无服务器配置文件的“插件”部分中。

serverless.yml sn-p

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 sn-p

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()'

需要一些见解,我错过了什么创建错误

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

    • 我已经添加了 bitbucket-pipeline.yml sn-p。之前它工作正常,在我升级 serverless-domain-manager 之后,我得到 serverless-domain-manager not found
    • 你想确保插件列在你的 package.json 中吗?
    • 我发现脚本无法仅使用 npm install --global copy 安装插件,然后我在管道的脚本部分添加了 npm install 并且工作正常。感谢您的帮助
    猜你喜欢
    • 2020-01-28
    • 1970-01-01
    • 2021-01-07
    • 2019-08-26
    • 2023-01-27
    • 2021-08-22
    • 2019-12-24
    • 2019-04-30
    • 2020-02-11
    相关资源
    最近更新 更多