簡體   English   中英

無服務器框架無法連接到 AWS 中現有的 REST API

[英]Serverless framework can't connect to existing REST API in AWS

您好,在此先感謝您的幫助,我正在嘗試將我的無服務器文件連接到 AWS 中現有的 API Rest 但是當我進行部署時它失敗並顯示消息:CREATE_FAILED: ApiGatewayResourceOtherversion (AWS::ApiGateway::Resource) Resource handler returned消息:“指定的資源標識符無效

這是我的無服務器文件中的配置和雲中的 API

service: test-api-2

frameworkVersion: '3'

provider:
  name: aws
  region: us-east-1
  runtime: python3.8
  apiGateway: 
    restApiId: 7o3h7b2zy5
    restApiRootResourceId: "/second"



functions:
  hello_oscar:
    handler: test-api/handler.hello_oscar
    events:
        # every Monday at 03:15 AM
        - schedule: cron(15 3 ? * MON *)
        #- sqs: arn:aws:sqs:region:XXXXXX:MyFirstQueue
    package:
      include:
        - test-api/**
  get:
    handler:  hexa/application/get/get.get_information
    memorySize: 128
    description: Test function
    events:
    - http:
        path: /hola
        method: GET
        cors: true
    package:
      include:
        - hexa/**
  other_version:
    handler: other_version/use_other.another_version
    layers:
      - xxxxxxxxx
    runtime: python3.7
    description: Uses other version of python3.7
    events:
      - http:
          path: /other_version
          method: POST
          cors: true
    package:
      include:
        - other_version/**
  diferente:
    handler: other_version/use_other.another_version
    layers:
      - xxxxxxxxxxxxxx
    runtime: python3.8

在此處輸入圖像描述

在示例 serverless.yml 中,您將restApiRootResourceId屬性設置為/second ,您應該將其設置為根資源 ID,在屏幕截圖中顯示為bt6nd8xw4l

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM