dougmoscrop / serverless-plugin-split-stacks

A plugin to generate nested stacks to get around CloudFormation resource/parameter/output limits
297 stars 68 forks source link

Successfully deploy, but can't remove #24

Open ozbillwang opened 6 years ago

ozbillwang commented 6 years ago

I have successfully deployed my serverless stack

Serverless: [serverless-plugin-split-stacks]: Summary: 84 resources migrated in to 4 nested stacks
Serverless: [serverless-plugin-split-stacks]:    Resources per stack:
Serverless: [serverless-plugin-split-stacks]:    - (root): 122
Serverless: [serverless-plugin-split-stacks]:    - APINestedStack: 23
Serverless: [serverless-plugin-split-stacks]:    - FiltersNestedStack: 1
Serverless: [serverless-plugin-split-stacks]:    - PermissionsNestedStack: 30
Serverless: [serverless-plugin-split-stacks]:    - VersionsNestedStack: 30
Serverless: Creating Stack...

But when I try to serverless remove it, I got this error:

  Serverless Error ---------------------------------------

  Resource ApiGatewayRestApi does not exist for stack serverless-dev

I use the latest release

  "devDependencies": {
    "serverless-plugin-split-stacks": "^1.3.2"
  }
dougmoscrop commented 6 years ago

Do you have any other plugins loaded?

What version of serverless?

ozbillwang commented 6 years ago

@dougmoscrop

There is only one plugin serverless-plugin-split-stacks I used.

the serverless version is v1.25

dougmoscrop commented 6 years ago

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.

ozbillwang commented 6 years ago

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.

ozbillwang commented 6 years ago

Not sure, if related to this issue as well https://github.com/dougmoscrop/serverless-plugin-split-stacks/issues/9

pavloPyrig0 commented 6 years ago

Have the same issue with deleting. Serverless version 1.27.3

sweepy84 commented 5 years ago

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?

toriiico commented 5 years ago

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"}'
    }
dougmoscrop commented 5 years ago

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?

toriiico commented 5 years ago

Hi, @dougmoscrop . The following is the log and development environment when deploy and remove. The contents of the log have been partially rewritten.

Development Environment

Command Logs

export SLS_DEBUG=*

npx sls deploy -v

``` Serverless: Load command config Serverless: Load command config:credentials Serverless: Load command create Serverless: Load command install Serverless: Load command package Serverless: Load command deploy Serverless: Load command deploy:function Serverless: Load command deploy:list Serverless: Load command deploy:list:functions Serverless: Load command invoke Serverless: Load command invoke:local Serverless: Load command info Serverless: Load command logs Serverless: Load command metrics Serverless: Load command print Serverless: Load command remove Serverless: Load command rollback Serverless: Load command rollback:function Serverless: Load command slstats Serverless: Load command plugin Serverless: Load command plugin Serverless: Load command plugin:install Serverless: Load command plugin Serverless: Load command plugin:uninstall Serverless: Load command plugin Serverless: Load command plugin:list Serverless: Load command plugin Serverless: Load command plugin:search Serverless: Load command config Serverless: Load command config:credentials Serverless: Load command rollback Serverless: Load command rollback:function Serverless: Invoke deploy Serverless: Invoke package Serverless: Invoke aws:common:validate Serverless: Invoke aws:common:cleanupTempDir Serverless: Packaging service... Serverless: Excluding development dependencies... Serverless: Invoke aws:package:finalize Serverless: [AWS cloudformation 400 1.316s 0 retries] listStackResources({ StackName: 'serverless-split-stacks-test-tmpdeploy', NextToken: undefined }) Serverless: [serverless-plugin-split-stacks]: Summary: 3 resources migrated in to 3 nested stacks Serverless: [serverless-plugin-split-stacks]: Resources per stack: Serverless: [serverless-plugin-split-stacks]: - (root): 13 Serverless: [serverless-plugin-split-stacks]: - APINestedStack: 1 Serverless: [serverless-plugin-split-stacks]: - PermissionsNestedStack: 1 Serverless: [serverless-plugin-split-stacks]: - VersionsNestedStack: 1 Serverless: Invoke aws:common:moveArtifactsToPackage Serverless: Invoke aws:common:validate Serverless: Invoke aws:deploy:deploy Serverless: [AWS cloudformation 400 1.063s 0 retries] describeStacks({ StackName: 'serverless-split-stacks-test-tmpdeploy' }) Serverless: Creating Stack... Serverless: [AWS cloudformation 200 1.328s 0 retries] createStack({ StackName: 'serverless-split-stacks-test-tmpdeploy', OnFailure: 'DELETE', Capabilities: [ 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', [length]: 2 ], Parameters: [ [length]: 0 ], TemplateBody: '{"AWSTemplateFormatVersion":"2010-09-09","Description":"The AWS CloudFormation template for this Serverless application","Resources":{"ServerlessDeploymentBucket":{"Type":"AWS::S3::Bucket","Properties":{"BucketEncryption":{"ServerSideEncryptionConfiguration":[{"ServerSideEncryptionByDefault":{"SSEAlgorithm":"AES256"}}]}}}},"Outputs":{"ServerlessDeploymentBucketName":{"Value":{"Ref":"ServerlessDeploymentBucket"}}}}', Tags: [ { Key: 'STAGE', Value: 'tmpdeploy' }, [length]: 1 ] }) Serverless: Checking Stack create progress... Serverless: [AWS cloudformation 200 1.037s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:000000000000:stack/serverless-split-stacks-test-tmpdeploy/facc8830-574c-11e9-9eab-1297d6a5b478' }) CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - serverless-split-stacks-test-tmpdeploy CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket Serverless: [AWS cloudformation 200 1.173s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:000000000000:stack/serverless-split-stacks-test-tmpdeploy/facc8830-574c-11e9-9eab-1297d6a5b478' }) Serverless: [AWS cloudformation 200 0.905s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:000000000000:stack/serverless-split-stacks-test-tmpdeploy/facc8830-574c-11e9-9eab-1297d6a5b478' }) Serverless: [AWS cloudformation 200 0.903s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:000000000000:stack/serverless-split-stacks-test-tmpdeploy/facc8830-574c-11e9-9eab-1297d6a5b478' }) Serverless: [AWS cloudformation 200 0.954s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:000000000000:stack/serverless-split-stacks-test-tmpdeploy/facc8830-574c-11e9-9eab-1297d6a5b478' }) CloudFormation - CREATE_COMPLETE - AWS::S3::Bucket - ServerlessDeploymentBucket CloudFormation - CREATE_COMPLETE - AWS::CloudFormation::Stack - serverless-split-stacks-test-tmpdeploy Serverless: Stack create finished... Serverless: [AWS cloudformation 200 1.081s 0 retries] describeStackResource({ StackName: 'serverless-split-stacks-test-tmpdeploy', LogicalResourceId: 'ServerlessDeploymentBucket' }) Serverless: [AWS s3 200 1.007s 0 retries] listObjectsV2({ Bucket: 'serverless-split-stacks-serverlessdeploymentbuck-lstyi9kci8l7', Prefix: 'serverless/serverless-split-stacks-test/tmpdeploy' }) Serverless: [AWS sts 200 0.953s 0 retries] getCallerIdentity({}) Serverless: Uploading CloudFormation file to S3... Serverless: [AWS s3 200 1.563s 0 retries] putObject({ Body: , Bucket: 'serverless-split-stacks-serverlessdeploymentbuck-lstyi9kci8l7', Key: 'path/to/compiled-cloudformation-template.json', ContentType: 'application/json', Metadata: { filesha256: 'somehash=' } }) Serverless: Uploading artifacts... Serverless: Uploading service serverless-split-stacks-test.zip file to S3 (418.5 KB)... Serverless: [AWS s3 200 7.004s 0 retries] putObject({ Body: , Bucket: 'serverless-split-stacks-serverlessdeploymentbuck-lstyi9kci8l7', Key: 'path/to/serverless-split-stacks-test.zip', ContentType: 'application/zip', Metadata: { filesha256: 'somehash=' } }) Serverless: [AWS cloudformation 200 1.124s 0 retries] describeStackResource({ StackName: 'serverless-split-stacks-test-tmpdeploy', LogicalResourceId: 'ServerlessDeploymentBucket' }) Serverless: [AWS s3 200 1.257s 0 retries] putObject({ Bucket: 'serverless-split-stacks-serverlessdeploymentbuck-lstyi9kci8l7', Key: 'path/to/cloudformation-template-API-nested-stack.json', Body: ReadStream { _readableState: ReadableState { objectMode: false, highWaterMark: 65536, buffer: BufferList { head: null, tail: null, length: 0 }, length: 0, pipes: null, pipesCount: 0, flowing: false, ended: true, endEmitted: true, reading: false, sync: false, needReadable: false, emittedReadable: false, readableListening: false, resumeScheduled: false, destroyed: true, defaultEncoding: 'utf8', awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, readable: false, domain: null, _events: { end: { [Function] [length]: 0, [name]: '', [prototype]: { [constructor]: [Circular] } } }, _eventsCount: 1, _maxListeners: undefined, path: '/path/to/serverless-split-stacks-test/.serverless/cloudformation-template-API-nested-stack.json', fd: null, flags: 'r', mode: 438, start: undefined, end: Infinity, autoClose: true, pos: undefined, bytesRead: 697, closed: true }, ContentType: 'application/json' }) Serverless: [AWS s3 200 1.254s 0 retries] putObject({ Bucket: 'serverless-split-stacks-serverlessdeploymentbuck-lstyi9kci8l7', Key: 'serverless/serverless-split-stacks-test/tmpdeploy/1554432371404-2019-04-05T02:46:11.404Z/cloudformation-template-Permissions-nested-stack.json', Body: ReadStream { _readableState: ReadableState { objectMode: false, highWaterMark: 65536, buffer: BufferList { head: null, tail: null, length: 0 }, length: 0, pipes: null, pipesCount: 0, flowing: false, ended: true, endEmitted: true, reading: false, sync: false, needReadable: false, emittedReadable: false, readableListening: false, resumeScheduled: false, destroyed: true, defaultEncoding: 'utf8', awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, readable: false, domain: null, _events: { end: { [Function] [length]: 0, [name]: '', [prototype]: { [constructor]: [Circular] } } }, _eventsCount: 1, _maxListeners: undefined, path: '/path/to/serverless-split-stacks-test/.serverless/cloudformation-template-Permissions-nested-stack.json', fd: null, flags: 'r', mode: 438, start: undefined, end: Infinity, autoClose: true, pos: undefined, bytesRead: 1310, closed: true }, ContentType: 'application/json' }) Serverless: [AWS s3 200 1.278s 0 retries] putObject({ Bucket: 'serverless-split-stacks-serverlessdeploymentbuck-lstyi9kci8l7', Key: 'serverless/serverless-split-stacks-test/tmpdeploy/1554432371404-2019-04-05T02:46:11.404Z/cloudformation-template-Versions-nested-stack.json', Body: ReadStream { _readableState: ReadableState { objectMode: false, highWaterMark: 65536, buffer: BufferList { head: null, tail: null, length: 0 }, length: 0, pipes: null, pipesCount: 0, flowing: false, ended: true, endEmitted: true, reading: false, sync: false, needReadable: false, emittedReadable: false, readableListening: false, resumeScheduled: false, destroyed: true, defaultEncoding: 'utf8', awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, readable: false, domain: null, _events: { end: { [Function] [length]: 0, [name]: '', [prototype]: { [constructor]: [Circular] } } }, _eventsCount: 1, _maxListeners: undefined, path: '/path/to/serverless-split-stacks-test/.serverless/cloudformation-template-Versions-nested-stack.json', fd: null, flags: 'r', mode: 438, start: undefined, end: Infinity, autoClose: true, pos: undefined, bytesRead: 757, closed: true }, ContentType: 'application/json' }) Serverless: Validating template... Serverless: [AWS cloudformation 200 1.236s 0 retries] validateTemplate({ TemplateURL: 'https://s3.amazonaws.com/path/to/compiled-cloudformation-template.json' }) Serverless: Updating Stack... Serverless: [AWS cloudformation 200 1.482s 0 retries] updateStack({ StackName: 'serverless-split-stacks-test-tmpdeploy', Capabilities: [ 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', [length]: 2 ], Parameters: [ [length]: 0 ], TemplateURL: 'https://s3.amazonaws.com/path/to/compiled-cloudformation-template.json', Tags: [ { Key: 'STAGE', Value: 'tmpdeploy' }, [length]: 1 ] }) Serverless: Checking Stack update progress... Serverless: [AWS cloudformation 200 1.084s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:000000000000:stack/serverless-split-stacks-test-tmpdeploy/facc8830-574c-11e9-9eab-1297d6a5b478' }) CloudFormation - UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - serverless-split-stacks-test-tmpdeploy Serverless: [AWS cloudformation 200 0.967s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:000000000000:stack/serverless-split-stacks-test-tmpdeploy/facc8830-574c-11e9-9eab-1297d6a5b478' }) CloudFormation - CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - APINestedStack CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - RootLogGroup CloudFormation - CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - APINestedStack CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - RootLogGroup CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - RootLogGroup Serverless: [AWS cloudformation 200 0.972s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:000000000000:stack/serverless-split-stacks-test-tmpdeploy/facc8830-574c-11e9-9eab-1297d6a5b478' }) Serverless: [AWS cloudformation 200 1.173s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:000000000000:stack/serverless-split-stacks-test-tmpdeploy/facc8830-574c-11e9-9eab-1297d6a5b478' }) CloudFormation - CREATE_COMPLETE - AWS::CloudFormation::Stack - APINestedStack CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodOptions CloudFormation - CREATE_COMPLETE - AWS::IAM::Role - IamRoleLambdaExecution CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodOptions CloudFormation - CREATE_COMPLETE - AWS::ApiGateway::Method - ApiGatewayMethodOptions Serverless: [AWS cloudformation 200 1.659s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:000000000000:stack/serverless-split-stacks-test-tmpdeploy/facc8830-574c-11e9-9eab-1297d6a5b478' }) CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Function - RootLambdaFunction CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Function - RootLambdaFunction CloudFormation - CREATE_COMPLETE - AWS::Lambda::Function - RootLambdaFunction CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodGet CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodGet CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - PermissionsNestedStack CloudFormation - CREATE_COMPLETE - AWS::ApiGateway::Method - ApiGatewayMethodGet Serverless: [AWS cloudformation 200 1.261s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:000000000000:stack/serverless-split-stacks-test-tmpdeploy/facc8830-574c-11e9-9eab-1297d6a5b478' }) CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - VersionsNestedStack CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - PermissionsNestedStack CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - VersionsNestedStack CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1554432366117 CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1554432366117 CloudFormation - CREATE_COMPLETE - AWS::ApiGateway::Deployment - ApiGatewayDeployment1554432366117 Serverless: [AWS cloudformation 200 1.947s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:000000000000:stack/serverless-split-stacks-test-tmpdeploy/facc8830-574c-11e9-9eab-1297d6a5b478' }) CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::UsagePlan - ApiGatewayUsagePlan CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::ApiKey - ApiGatewayApiKey1 CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::ApiKey - ApiGatewayApiKey1 CloudFormation - CREATE_COMPLETE - AWS::ApiGateway::ApiKey - ApiGatewayApiKey1 CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::UsagePlan - ApiGatewayUsagePlan CloudFormation - CREATE_COMPLETE - AWS::ApiGateway::UsagePlan - ApiGatewayUsagePlan CloudFormation - CREATE_COMPLETE - AWS::CloudFormation::Stack - VersionsNestedStack CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::UsagePlanKey - ApiGatewayUsagePlanKey1 Serverless: [AWS cloudformation 200 1.843s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:000000000000:stack/serverless-split-stacks-test-tmpdeploy/facc8830-574c-11e9-9eab-1297d6a5b478' }) CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::UsagePlanKey - ApiGatewayUsagePlanKey1 CloudFormation - CREATE_COMPLETE - AWS::ApiGateway::UsagePlanKey - ApiGatewayUsagePlanKey1 Serverless: [AWS cloudformation 200 2.473s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:000000000000:stack/serverless-split-stacks-test-tmpdeploy/facc8830-574c-11e9-9eab-1297d6a5b478' }) CloudFormation - CREATE_COMPLETE - AWS::CloudFormation::Stack - PermissionsNestedStack CloudFormation - UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - serverless-split-stacks-test-tmpdeploy Serverless: [AWS cloudformation 200 3.312s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:000000000000:stack/serverless-split-stacks-test-tmpdeploy/facc8830-574c-11e9-9eab-1297d6a5b478' }) CloudFormation - UPDATE_COMPLETE - AWS::CloudFormation::Stack - serverless-split-stacks-test-tmpdeploy Serverless: Stack update finished... Serverless: Invoke aws:info Serverless: [AWS cloudformation 200 1.045s 0 retries] describeStacks({ StackName: 'serverless-split-stacks-test-tmpdeploy' }) Serverless: [AWS cloudformation 200 1.011s 0 retries] listStackResources({ StackName: 'serverless-split-stacks-test-tmpdeploy' }) Serverless: [AWS apigateway 200 1.161s 0 retries] getApiKeys({ includeValues: true }) Service Information service: serverless-split-stacks-test stage: tmpdeploy region: us-east-1 stack: serverless-split-stacks-test-tmpdeploy resources: 13 api keys: tmpdeploy-serverless-split-stacks-test-api-key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx endpoints: GET - https://0000000000.execute-api.us-east-1.amazonaws.com/tmpdeploy/ functions: Root: serverless-split-stacks-test-tmpdeploy-Root layers: None Stack Outputs RootLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:000000000000:function:serverless-split-stacks-test-tmpdeploy-Root:4 ServiceEndpoint: https://0000000000.execute-api.us-east-1.amazonaws.com/tmpdeploy ServerlessDeploymentBucketName: serverless-split-stacks-serverlessdeploymentbuck-lstyi9kci8l7 Serverless: Invoke aws:deploy:finalize Serverless: [AWS s3 200 1.008s 0 retries] listObjectsV2({ Bucket: 'serverless-split-stacks-serverlessdeploymentbuck-lstyi9kci8l7', Prefix: 'serverless/serverless-split-stacks-test/tmpdeploy' }) ```

npx sls remove -v

``` Serverless: Load command config Serverless: Load command config:credentials Serverless: Load command create Serverless: Load command install Serverless: Load command package Serverless: Load command deploy Serverless: Load command deploy:function Serverless: Load command deploy:list Serverless: Load command deploy:list:functions Serverless: Load command invoke Serverless: Load command invoke:local Serverless: Load command info Serverless: Load command logs Serverless: Load command metrics Serverless: Load command print Serverless: Load command remove Serverless: Load command rollback Serverless: Load command rollback:function Serverless: Load command slstats Serverless: Load command plugin Serverless: Load command plugin Serverless: Load command plugin:install Serverless: Load command plugin Serverless: Load command plugin:uninstall Serverless: Load command plugin Serverless: Load command plugin:list Serverless: Load command plugin Serverless: Load command plugin:search Serverless: Load command config Serverless: Load command config:credentials Serverless: Load command rollback Serverless: Load command rollback:function Serverless: Invoke remove Serverless: Removing usage plan association... Serverless: [AWS apigateway 200 1.054s 0 retries] getUsagePlans({}) Serverless: [AWS cloudformation 400 1.347s 0 retries] describeStackResource({ StackName: 'serverless-split-stacks-test-tmpdeploy', LogicalResourceId: 'ApiGatewayRestApi' }) Serverless Error --------------------------------------- Resource ApiGatewayRestApi does not exist for stack serverless-split-stacks-test-tmpdeploy Stack Trace -------------------------------------------- ServerlessError: Resource ApiGatewayRestApi does not exist for stack serverless-split-stacks-test-tmpdeploy at promise.catch.err (/path/to/serverless-split-stacks-test/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:295:11) at at process._tickDomainCallback (internal/process/next_tick.js:228:7) Get Support -------------------------------------------- Docs: docs.serverless.com Bugs: github.com/serverless/serverless/issues Issues: forum.serverless.com Your Environment Information --------------------------- OS: darwin Node Version: 8.11.3 Serverless Version: 1.40.0 ```
toriiico commented 5 years ago

I checked a little more. Certainly ApiGatewayRestApi did not exist in the root stack. It was present in nested stack :)

RootStack RootStack

APINestedStack APINestedStack

If you can fake the resource confirmation when doing remove, you might be able to solve it? 🤔

dougmoscrop commented 5 years ago

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.

toriiico commented 5 years ago

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 :)

christophgysin commented 5 years ago

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,
};