首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Serverless未能在本地堆栈上部署

Serverless未能在本地堆栈上部署
EN

Stack Overflow用户
提问于 2022-08-16 14:25:59
回答 1查看 207关注 0票数 0

我试图使用本地堆栈在本地部署lambda,但由于无法解析变量configFile,它失败了。

我的框架版本是3

代码语言:javascript
复制
service: score-api

frameworkVersion: '3'

plugins:
  - serverless-deployment-bucket
  - serverless-localstack

custom:
  stage: ${opt:stage, self:provider.stage}
  region: ${opt:region, self:provider.region}
  configFile: ${file(./config/${self:custom.stage}.json)}
  serviceName: test-api
  priority: 180
  optionsOnly: false
  redirect: false
  localstack:
    # list of stages for which the plugin should be enabled
    stages:
      - dev
    host: http://localhost
    autostart: true  # optional - Start LocalStack in Docker on Serverless deploy
    #endpoints:
      # This section is optional - can be used for customizing the target endpoints
      #S3: http://localhost:4572
      #DynamoDB: http://localhost:4570
      #CloudFormation: http://localhost:4581
      #Elasticsearch: http://localhost:4571
      #ES: http://localhost:4578
      #SNS: http://localhost:4575
      #SQS: http://localhost:4576
      #Lambda: http://localhost:4574
      #Kinesis: http://localhost:4568
    debug: true
    lambda:
      mountCode: True # enable this flag for performance (True didn't work for me)
    docker:
      sudo: False # enable this flag to run "docker ..." commands as sudo
  stages:
    dev:

我一直在

代码语言:javascript
复制
Running "serverless" from node_modules
Environment: darwin, node 18.2.0, framework 3.16.0 (local) 3.22.0v (global), plugin 6.2.2, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Cannot resolve serverless.yml: Variables resolution errored with:
  - Cannot resolve variable at "custom.configFile": Value not found at "file" source
EN

回答 1

Stack Overflow用户

发布于 2022-11-07 15:14:31

这似乎是Serverless框架3.x版本的一个问题。我将无服务器框架版本降级为2.x,错误自行解决。

“‘npm安装-g无服务器@2’‘”

下面的链接可能有助于坚持新的变量解析方法。

Serverless Framework - Variables resolution error

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73375643

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档