创建变更集时出错 - "DependsOn must be a string or list of strings."

Error while creating changeset - "DependsOn must be a string or list of strings."

我正在使用 cloudformation 来部署我的代码。在我的 yml 文件中,我尝试将此 DependsOn 属性添加为“AppApiv1Stage”。我尝试了很多事情,每次它都会给出不同的错误,我不确定我做错了什么。在下面的代码片段中,我首先将它添加在双引号中,如下所示:"AppApiv1Stage" 然后它显示错误。我再次尝试使用以下代码,然后它显示错误为“DependsOn 必须是字符串或字符串列表”

Parameters:
  ApiStageSecondDeploymentName:
    Description: API Stage name to use
    Type: String
    Default: v1
Resources:
 AppAPI:
    Type: AWS::Serverless::Api
    DependsOn: AuthFunction
    Properties:
      Name: !Sub ${AWS::StackName}
      StageName: !Ref ApiStageSecondDeploymentName          
      Variables:
        LocalTLD: local                                    # Deploys a Dev stage to use for tests and development
      MethodSettings:
        - LoggingLevel: ERROR
          MetricsEnabled: True
          DataTraceEnabled: True
          HttpMethod: '*'
          ResourcePath: '/*'
          ThrottlingBurstLimit: !Ref ApiBurstLimit
          ThrottlingRateLimit: !Ref ApiRateLimit
ApiMapping:
    DependsOn: !Sub AppAPI !Ref ${ApiStageSecondDeploymentName}Stage
    Type: AWS::ApiGateway::BasePathMapping
    Properties:
      BasePath: !Ref ApiStageSecondDeploymentName
      DomainName:
        Fn::ImportValue: !Sub ${CustomDomainStack}-DNSName
      RestApiId: !Ref AppAPI

我也试过加入!但再次显示错误。

not sure what I am doing wrong

DependsOn,如错误所述,必须是 字符串 字符串列表 。不是内部函数 (Sub, Ref)。

此外,内部函数只能在模板中的少数地方使用,none 其中 DependsOn。来自 docs:

You can use intrinsic functions only in specific parts of a template. Currently, you can use intrinsic functions in resource properties, outputs, metadata attributes, and update policy attributes. You can also use intrinsic functions to conditionally create stack resources.