添加 serverless-split-stack 插件和临时并发配置时出现无服务器部署问题

问题描述 投票:0回答:1

我遇到过一种情况,我的项目资源超出了 AWS 的 500 个云堆栈限制,因此, 我被迫使用 serverless-split-stack 插件。它按预期进行部署,而没有向函数添加临时并发参数。 添加此配置后,部署开始失败,有人遇到过类似的情况吗?如果有人能帮助我解决这个问题,那就太好了。

出现错误:

Stack dm-scratch-v2-test 部署失败(1359s) 环境:darwin,节点14.15.4,框架3.34.0(本地)3.34.0v(全局),插件6.2.3,SDK 4.3.2 凭证:本地、环境变量

CloudFormation 模板无效:模板格式错误:模板的资源块中未解析的资源依赖项 [AuthorizerFuncLambdaFunctionArnParameter]

service: dm-scratch-v2

frameworkVersion: '3'

# general configurations
provider:
  runtime: python3.8
  name: aws
  logs:
    restApi: true
  timeout: 29  # in seconds
  ecr:
    images:
      appimage:
        path: ./
  httpApi:
    cors: true
    authorizers:
      Authorizer:
        type: request
        functionName: authorizerFunc
        resultTtlInSeconds: 300
        identitySource:
          - $request.header.Authorization
  deploymentBucket:
    name: mysvc-v2-deployments
    serverSideEncryption: AES256
  versionFunctions: false
  stage: dev
  region: us-west-1


custom:
  basename: ${self:service}-${self:provider.stage}
  pythonRequirements:
    dockerizePip: true
    slim: true
    usePipenv: false
    zip: true
  splitStacks:
    nestedStackCount: 20 # Controls the number of created nested stacks
    perFunction: false
    perType: true
    perGroupFunction: true

functions:
  authorizerFunc:
    provisionedConcurrency: 1
    image:
      name: appimage
      command:
        - gateway.policy.auth.user_token_authorizer
      entryPoint:
        - '/lambda-entrypoint.sh'
  user_roles:
    provisionedConcurrency: 1
    image:
      name: appimage
      command:
        - user.events.roles.main
      entryPoint:
        - '/lambda-entrypoint.sh'
    events:
      - httpApi:
          path: /roles
          method: get
          authorizer:
            name: Authorizer

  get_role_info:
    provisionedConcurrency: 1
    image:
      name: appimage
      command:
        - user.events.roles.get_role_id_by_token
      entryPoint:
        - '/lambda-entrypoint.sh'
    events:
      - httpApi:
          path: /role/info
          method: get
          authorizer:
            name: Authorizer

    ......................
    ......................
    ......................
    ......................
    ......................
    
  clear_all:
    provisionedConcurrency: 1
    image:
      name: appimage
      command:
        - device.events.devices.clearall
      entryPoint:
        - '/lambda-entrypoint.sh'
    events:
      - httpApi:
          path: /devices/{device_id}/clearall
          method: delete
          authorizer:
            name: Authorizer

  list_all_policy:
    provisionedConcurrency: 1
    image:
      name: appimage
      command:
        - policy.events.main.policy
      entryPoint:
        - '/lambda-entrypoint.sh'
    events:
      - httpApi:
          path: /policy/list
          method: get
          authorizer:
            name: Authorizer

# place to manage plugins
plugins:
  - serverless-offline
  - serverless-python-requirements
  - serverless-plugin-split-stacks

cloud serverless aws-serverless sam
1个回答
0
投票

默认情况下,插件会将资源拆分为堆栈,授权者函数不再与 APIGW 资源位于同一堆栈中。您可能想尝试不同的拆分设置,该插件提供了如何拆分资源的完全自定义:https://github.com/dougmoscrop/serverless-plugin-split-stacks#advanced-usage

© www.soinside.com 2019 - 2024. All rights reserved.