WebsocketsDeployment doesn't respect custom resources.
#8.434 geöffnet am 23. Okt. 2020
Beschreibung
I have custom integration API GW websockets - sqs, which requires to add few custom resources like
WSToSQSIntegration:
Type: AWS::ApiGatewayV2::Integration
Properties:
ApiId:
Ref: WebsocketsApi
....
WSToSQSRoute:
Type: AWS::ApiGatewayV2::Route
Properties:
ApiId:
Ref: WebsocketsApi
RouteKey: "$default"
AuthorizationType: NONE
....
Whenever any of those resource is changed after running sls deploy api not updates because WebsocketsDeployment{hash} stays the same.
The reason behind that in a way deployment id is built for websockets, hash of cloudformation part template without custom resources.
https://github.com/serverless/serverless/blob/9c0f6461b73976958ebdd7e2762c6d1fbd469da1/lib/plugins/aws/package/compile/events/websockets/lib/deployment.js#L24-L30
where as for the rest api it just a simple new Date().getTime().toString(); which is instanceId
https://github.com/serverless/serverless/blob/f93b27bf684d9a14b1e67ec554a7719ca3628135/lib/plugins/aws/package/compile/events/apiGateway/lib/deployment.js#L8-L10
Proposal is to replace hash part with same instanceId for websockets.
I'm ready to submit PR if maintainers give it a go. Thanks