首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在AWS SAM模板部署过程中获得未解决的错误

在AWS SAM模板部署过程中获得未解决的错误
EN

Stack Overflow用户
提问于 2021-12-09 05:34:58
回答 1查看 506关注 0票数 1

我想用post方法创建一个lambda函数和API网关,使用AWS模板,并使用Github管道部署模板。

代码语言:javascript
复制
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
  lambda-neo4j

  Sample SAM Template for lambda-neo4j

# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
  Function:
    Timeout: 180

Resources:
  MyGraphFunction:
    Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
    Properties:
      FunctionName: "test-my-graph"
      CodeUri: my_graph/
      Handler: app.lambda_handler
      Runtime: python3.9
      Architectures:
        - x86_64
      Events:
        MyGraph:
          Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
          Properties:
            Path: /mygraph
            Method: post
      Role: arn:aws:iam::1234567890:role/my-lambda-role-s3
      Environment:
        Variables:
          URI: Demo
          USER_NAME: Demo
          PASSWORD: Demo

Outputs:
  MyGraphApi:
    Description: "API Gateway endpoint URL for Prod stage for My Graph function"
    Value: !Ref "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/mygraph/"
  MyGraphFunction:
    Description: "MyGraph Lambda Function ARN"
    Value: !GetAtt MyGraphFunction.Arn

越来越少的错误。

代码语言:javascript
复制
Error: Failed to create changeset for the stack: sam-lambda-neo4j, ex: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state: For expression "Status" we matched expected path: "FAILED" Status: FAILED. Reason: Unresolved resource dependencies [https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/mygraph/] in the Outputs block of the template

请帮助,谢谢:)

EN

回答 1

Stack Overflow用户

发布于 2021-12-09 19:52:48

您的输出是使用错误的字符串函数(参考),使用Sub代替

代码语言:javascript
复制
Outputs:
  MyGraphApi:
    Description: "API Gateway endpoint URL for Prod stage for My Graph function"
    Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/mygraph/"
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70285163

复制
相关文章

相似问题

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