'Serverless framework can't connect to existing REST API in AWS
Hello and thanks in advance for the help, Im trying to connect my serverless file to an existing API Rest in AWS but when I make the deploy it fails with the message: CREATE_FAILED: ApiGatewayResourceOtherversion (AWS::ApiGateway::Resource) Resource handler returned message: "Invalid Resource identifier specified
Here is the configuration in my serverless file and the API in the cloud
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
Solution 1:[1]
In the example serverless.yml, where you have the restApiRootResourceId
property set to /second
, you should have it set to the root resource id, which is shown in your screen shot as bt6nd8xw4l
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Dave |