-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serverless framework deleting the already existing resource on sls deploy #6810
Comments
Hi, I'm having the same issue. I have created a minimal example that reproduces the issue: https://github.com/tinexw/serverless-issue-6810 The example performs the following steps:
In all steps the
This seems to be the cause of the issue. If I remove the existing resource from the list, the issue does not appear. I found a unit test for the corresponding part of the code that seems to expect exactly this behavior: serverless/lib/plugins/aws/package/compile/events/apiGateway/lib/resources.test.js Line 377 in f93b27b
Please find the complete output of the minimal example below:
|
@jayanthck by declaring that you wish to setup configured endpoints on externally configured API Gateway resource, you've also declared that you don't need API Gateway resource that was created with a stack. In CloudFormation it is assumed that stack is the only owner of created resources, therefore if it's removed from CF as not needed, it is also deleted. So what you observed it's not a bug, it's the nature of the CF design. Closing, as I believe we can't do much about that |
serverless.yml.zip
Bug Report
deploying the serverless template when a resource already exists, it is deleting the resource instead of updating it or not doing any changes
Description
What did you do?
First I ran the sls deploy with out this property
restApiResources:
'test': hy1234
and after this, I added the above property and ran sls deploy again
What happened?
ApiGatewayResourceTest is getting deleted
What should've happened?
Instead of deleting the resource ApiGatewayResourceTest, it should have updated it or left the resource unchanged
What's the content of your
serverless.yml
file?attached the serverless.yml.zip
service: serverlessfunction
provider:
name: aws
region: 'eu-central-1'
stage: stage
runtime: nodejs10.x
apiGateway:
restApiId: '6k12345678'
restApiRootResourceId: '6j12345678'
restApiResources:
'test': hy1234
functions:
hello:
handler: handler.hello
events:
path: 'test'
method: post
cors: true
What's the output you get when you use the
SLS_DEBUG=*
environment variable (e.g.SLS_DEBUG=* serverless deploy
)ApiGatewayResourceTest is getting deleted
and there is new AGW deployment
The text was updated successfully, but these errors were encountered: