-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
We had to separate our API Gateway put it in one file (api.yaml) and have our lambdas in another (serverless.yaml), and then have the API being a imported value in serverless.yaml
BaseRequest:
Type: AWS::Serverless::Function
Properties:
...
Events:
GetResource:
Type: Api
Properties:
RestApiId:
Fn::ImportValue:
!Sub ${Service}-apigateway-${Environment}
Path: /{countryId}/{path}
Method: GET
PostResource:
Type: Api
Properties:
RestApiId:
Fn::ImportValue:
!Sub ${Service}-apigateway-${Environment}
Path: /{countryId}/{path}
Method: POST
This was never an issue up until a week ago, where we now receive the following error:
Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason: Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [BaseRequest] is invalid. Event with id [PostResource] is invalid. RestApiId must be a valid reference to an 'AWS::Serverless::Api' resource in same templatemake
One option would be to move the depending Lambda to api.yaml but we would like to have all of our Lambdas together in one file.