Open ozbillwang opened 6 years ago
Do you have any other plugins loaded?
What version of serverless?
@dougmoscrop
There is only one plugin serverless-plugin-split-stacks
I used.
the serverless version is v1.25
Hmm, I wonder if they have added something that expects the resources to exist during remove (outside of CF)
Can you reproduce this with SLS_DEBUG=* sls remove
-- maybe I can get a stack trace from it that suggests where to look.
Secondly I added extra cognito resources (AWS::Cognito::UserPool) in serverless framework.
I run two times, I found two cognito user pools are created, then I remove both of them from aws console.
Then I run sls deploy
many times, command is successful, but I don't see the cognito user pool is created any more.
Not sure if this is related this plugin as well.
Not sure, if related to this issue as well https://github.com/dougmoscrop/serverless-plugin-split-stacks/issues/9
Have the same issue with deleting. Serverless version 1.27.3
Having the same issue with removing. Serverless version 1.32. Looks like this has been a problem for a while (reported in Jan!), is there a fix in the works or a workaround?
Have the same issue.
I tried deploy simple serverless app. but, happened same probrem.
serverless.yml
service: serverless-split-stacks-test
plugins:
- serverless-plugin-split-stacks
provider:
name: aws
runtime: python3.7
stage: tmp
profile: myprof
region: us-east-1
apiKeys:
- ${self:provider.stage}-${self:service}-api-key
environment:
STAGE: ${self:provider.stage}
REGION: ${self:provider.region}
functions:
Root:
handler: src/index.root
events:
- http:
path: /
method: get
cors: true
private: true
package.json
{
"name": "serverless-split-stacks-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"serverless": "^1.40.0",
"serverless-plugin-split-stacks": "^1.7.2"
}
}
index.py
def root(event, context):
return {
'isBase64Encoded': False,
'statusCode': 200,
'headers': {},
'body': '{"message": "Hello from AWS Lambda"}'
}
Thanks, @toriiico - having a simple reproducible example like that is good; do you have a stack trace? Have you done any debugging that you can share?
Hi, @dougmoscrop . The following is the log and development environment when deploy and remove. The contents of the log have been partially rewritten.
export SLS_DEBUG=*
npx sls deploy -v
npx sls remove -v
I checked a little more. Certainly ApiGatewayRestApi did not exist in the root stack. It was present in nested stack :)
RootStack
APINestedStack
If you can fake the resource confirmation when doing remove, you might be able to solve it? 🤔
Thank you for the information!
I see it's because they're trying to remove usage plans. Faking it would make the usage plans not actually be removed, I don't know what the implications are.
Other options are to not migrate the ApiGatewayRestApi (by default - can still be overridden) or hijack https://github.com/serverless/serverless/search?utf8=%E2%9C%93&q=describeStackResource to understand stack migrations and re-write the request to call a different stack name. I think the latter is more versatile, but also a bit more brittle due to the principle of least surprise.
I see it's because they're trying to remove usage plans. Faking it would make the usage plans not actually be removed, I don't know what the implications are.
Even if RestApi is insufficient, Delete Stack can be executed from the AWS Console. So I thought that if we could fake the existence of RestApi we could delete it.
Proposed Thank you!
Also from me There is one suggestion.
How about excluding AWS::ApiGateway::RestApi
from DEFAULT_STACKS_MAP
in ./serverless-plugin-split-stacks/lib/migration-strategy/per-type
?
When I commented out in my environment and tried, I got the expected result.
I do not have a deep understanding of the internal implementation, so I would like to hear the opinions of @dougmoscrop :)
Instead of commenting out AWS::ApiGateway::RestApi
from DEFAULT_STACKS_MAP
, you can override it with a custom stacks-map.js
:
module.exports = {
'AWS::ApiGateway::RestApi': false,
};
I have successfully deployed my serverless stack
But when I try to
serverless remove
it, I got this error:I use the latest release