Giter VIP home page Giter VIP logo

serverless-plugin-split-stacks's Introduction

CircleCI

serverless-plugin-split-stacks

This plugin migrates CloudFormation resources in to nested stacks in order to work around the 500 resource limit.

There are built-in migration strategies that can be turned on or off as well as defining your own custom migrations. It is a good idea to select the best strategy for your needs from the start because the only reliable method of changing strategy later on is to recreate the deployment from scratch. You configure this in your serverless.yml (defaults shown):

custom:
  splitStacks:
    perFunction: false
    perType: true
    perGroupFunction: false

Migration Strategies

Per Lambda

This splits resources off in to a nested stack dedicated to the associated Lambda function. This defaults to off in 1.x but will switch to enabled by default in 2.x

Per Type

This moves resources in to a nested stack for the given resource type. If Per Lambda is enabled, it takes precedence over Per Type.

Per Lambda Group

This splits resources off in to a nested stack dedicated to a set of Lambda functions and associated resources. If Per Lambda or Per Type is enabled, it takes precedence over Per Lambda Group. In order to control the number of nested stacks, following configurations are needed:

custom:
  splitStacks:
    nestedStackCount: 20 # Controls the number of created nested stacks
    perFunction: false
    perType: false
    perGroupFunction: true

Once set, the nestedStackCount configuration should never be changed because the only reliable method of changing it later on is to recreate the deployment from scratch.

Concurrency

In order to avoid API rate limit errors, it is possible to configure the plugin in 2 different ways:

  • Set nested stacks to depend on each others.
  • Set resources in the nested stack to depend on each others.

This feature comes with a 2 new configurations, stackConcurrency and resourceConcurrency :

custom:
  splitStacks:
    perFunction: true
    perType: false
    perGroupFunction: false
    stackConcurrency: 5 # Controls if enabled and how much stacks are deployed in parallel. Disabled if absent.
    resourceConcurrency: 10 # Controls how much resources are deployed in parallel. Disabled if absent.

Limitations

This plugin is not a substitute for fine-grained services - try to limit the size of your service. This plugin has a hard limit of 200 sub-stacks and does not try to create any kind of tree of nested stacks.

Advanced Usage

If you create a file in the root of your Serverless project called stacks-map.js this plugin will load it.

This file can customize migrations, either by exporting a simple map of resource type to migration, or a function that can have whatever logic you want.

module.exports = {
  'AWS::DynamoDB::Table': { destination: 'Dynamodb' }
}
module.exports = (resource, logicalId) => {
  if (logicalId.startsWith("Foo")) return { destination: 'Foo' };

  // Falls back to default
};

You can also point to your custom splitter from the custom block in your serverless file:

custom:
  splitStacks:
    custom: path/to/your/splitter.js

Be careful when introducing any customizations to default config. Many kind of resources (as e.g. DynamoDB tables) cannot be freely moved between CloudFormation stacks (that can only be achieved via full removal and recreation of the stage)

Force Migration

Custom migrations can specify { force: true } to force the migration of an existing resource in to a new stack. BE CAREFUL. This will cause a resource to be deleted and recreated. It may not even work if CloudFormation tries to create the new one before deleting the old one and they have a name or some other unique property that cannot have two resources existing at the same time. It can also mean a small window of downtime during this period, for example as an AWS::Lambda::Permission is deleted/recreated calls may be denied until IAM sorts things out.

serverless-plugin-split-stacks's People

Contributors

c24w avatar danielcherubini avatar dbengsch avatar dependabot[bot] avatar dougmoscrop avatar gustavoemmel avatar hasibhassan avatar hoangsetup avatar jasonrowsell avatar jaydp17 avatar jormaechea avatar kessiler avatar kycermann avatar marcelomarra avatar medikoo avatar mhotchen avatar mickvanduijn avatar muja avatar perrin4869 avatar purefan avatar slushnys avatar tiagogoncalves89 avatar timo92 avatar vicary avatar xiqi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serverless-plugin-split-stacks's Issues

cannot find module serverless/lib/plugins/aws/lib/naming

I am using aws codepipeline (and codebuild) to do serverless deployment.

partial serverless.yml:

custom:
webpackIncludeModules: true
test:
node_env: test
prod:
node_env: prod
custom:
splitStacks:
perFunction: false
perType: true

provider:
name: aws
environment:
NODE_ENV: ${self:custom.${opt:stage}.node_env}
runtime: nodejs6.10
region: ap-southeast-2
vpc:
securityGroupIds: ${file(vpc-config-${opt:stage}.js):securityGroups}
subnetIds: ${file(vpc-config-${opt:stage}.js):subnets}

iamRoleStatements:
- Effect: "Allow"
Action:
- "logs:CreateLogGroup"
- "logs:CreateLogStream"
- "logs:PutLogEvents"
- "ec2:CreateNetworkInterface"
- "ec2:DescribeNetworkInterfaces"
- "ec2:DeleteNetworkInterface"
- "lambda:InvokeFunction"
- "s3:PutObject"
- "s3:GetObject"
- "s3:DeleteObject"
Resource: "*"

plugins:

  • serverless-offline
  • serverless-webpack
  • serverless-plugin-warmup
  • serverless-delete-loggroups
  • serverless-plugin-split-stacks

When I run serverless deploy, this is the partial buildspec.yml

env:
variables:
NODE_ENV: prod

phases:
install:
commands:
- apt-get update -y
- apt-get install python python-pip build-essential -y
- pip install --upgrade pip
- pip install awscli
pre_build:
commands:
- npm install -g serverless
- npm install
build:
commands:
- npm run dbup
- serverless remove logs --stage prod
- serverless deploy --stage prod

(The stage prod is used only to define the security group and subnet for the aws environment.)

I got this error:
Cannot find module 'serverless/lib/plugins/aws/lib/naming'

Stack trace:
Error: Cannot find module 'serverless/lib/plugins/aws/lib/naming'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (/codebuild/output/src731592243/src/node_modules/serverless-plugin-split-stacks/lib/migration-strategy/per-function.js:3:21)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (/codebuild/output/src731592243/src/node_modules/serverless-plugin-split-stacks/lib/migrate-new-resources.js:7:21)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (/codebuild/output/src731592243/src/node_modules/serverless-plugin-split-stacks/split-stacks.js:7:29)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at plugins.forEach.error (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:90:24)
at Array.forEach (native)
at PluginManager.loadPlugins (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:88:13)
at PluginManager.loadServicePlugins (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:142:10)
at PluginManager.loadAllPlugins (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:84:10)
at service.load.then (/usr/local/lib/node_modules/serverless/lib/Serverless.js:67:28)
From previous event:
at runCallback (timers.js:570:20)
at tryOnImmediate (timers.js:550:5)
at processImmediate [as _immediateCallback] (timers.js:529:5)
From previous event:
at __dirname (/usr/local/lib/node_modules/serverless/bin/serverless:28:46)
at Object. (/usr/local/lib/node_modules/serverless/bin/serverless:46:4)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.runMain (module.js:575:10)
at run (bootstrap_node.js:352:7)
at startup (bootstrap_node.js:144:9)
at bootstrap_node.js:467:3

Environment information:
OS: linux
Node Version: 6.3.1
Serverless Version: 1.27.2

Any help would be much appreciated.

serverSideEncryption error in 1.4.0

With nothing changing in our serverless.yml function, going from 1.3.2 to 1.4.0 makes deployments fail. Specific error message is below, but it appears to be that the code is expecting certain variables? We've pinned the version to 1.3.2 for now.r

Thanks for the help/plugin!

Type Error ---------------------------------------------

Cannot read property 'serverSideEncryption' of undefined

 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Stack Trace --------------------------------------------

TypeError: Cannot read property 'serverSideEncryption' of undefined
at encryptionFields.reduce (/home/travis/build/StediInc/platform-api-service/node_modules/serverless-plugin-split-stacks/lib/utils.js:289:33)
at Array.reduce ()
at ServerlessPluginSplitStacks.getEncryptionParams (/home/travis/build/StediInc/platform-api-service/node_modules/serverless-plugin-split-stacks/lib/utils.js:288:29)
at Promise.all._.map.file (/home/travis/build/StediInc/platform-api-service/node_modules/serverless-plugin-split-stacks/split-stacks.js:92:43)
at arrayMap (/home/travis/build/StediInc/platform-api-service/node_modules/lodash/lodash.js:631:23)
at Function.map (/home/travis/build/StediInc/platform-api-service/node_modules/lodash/lodash.js:9546:14)
at provider.getServerlessDeploymentBucketName.then.deploymentBucket (/home/travis/build/StediInc/platform-api-service/node_modules/serverless-plugin-split-stacks/split-stacks.js:83:30)
From previous event:
at ServerlessPluginSplitStacks.upload (/home/travis/build/StediInc/platform-api-service/node_modules/serverless-plugin-split-stacks/split-stacks.js:80:8)
at BbPromise.reduce (/home/travis/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/classes/PluginManager.js:372:55)
From previous event:
at PluginManager.invoke (/home/travis/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/classes/PluginManager.js:372:22)
at PluginManager.spawn (/home/travis/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/classes/PluginManager.js:390:17)
at AwsDeploy.BbPromise.bind.then (/home/travis/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:101:48)
From previous event:
at Object.deploy:deploy [as hook] (/home/travis/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:97:10)
at BbPromise.reduce (/home/travis/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/classes/PluginManager.js:372:55)
From previous event:
at PluginManager.invoke (/home/travis/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/classes/PluginManager.js:372:22)
at PluginManager.run (/home/travis/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/classes/PluginManager.js:403:17)
at variables.populateService.then (/home/travis/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/Serverless.js:102:33)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
at Serverless.run (/home/travis/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/Serverless.js:89:74)
at serverless.init.then (/home/travis/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/bin/serverless:42:50)
at

Using perFunction, Successfully deployed first time. But can't second time.

Encountered the error like blow.

> SLS_DEBUG=* sls deploy --stage dev -v

...

Serverless: Packaging service...
Serverless: Remove /MY_PRJ_DIR/.webpack
Serverless: Invoke aws:package:finalize

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

  Rate exceeded

  Stack Trace --------------------------------------------

ServerlessError: Rate exceeded
    at BbPromise.fromCallback.catch.err (/Users/mikami/.nodebrew/node/v9.7.0/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:258:33)
From previous event:
    at persistentRequest (/Users/mikami/.nodebrew/node/v9.7.0/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:247:13)
    at doCall (/Users/mikami/.nodebrew/node/v9.7.0/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:205:9)
    at BbPromise (/Users/mikami/.nodebrew/node/v9.7.0/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:216:14)
From previous event:
    at persistentRequest (/Users/mikami/.nodebrew/node/v9.7.0/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:203:38)
    at Object.request.requestQueue.add [as promiseGenerator] (/Users/mikami/.nodebrew/node/v9.7.0/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:237:49)
    at Queue._dequeue (/Users/mikami/.nodebrew/node/v9.7.0/lib/node_modules/serverless/node_modules/promise-queue/lib/index.js:153:30)
    at /Users/mikami/.nodebrew/node/v9.7.0/lib/node_modules/serverless/node_modules/promise-queue/lib/index.js:160:26
From previous event:
    at Queue._dequeue (/Users/mikami/.nodebrew/node/v9.7.0/lib/node_modules/serverless/node_modules/promise-queue/lib/index.js:155:18)
    at /Users/mikami/.nodebrew/node/v9.7.0/lib/node_modules/serverless/node_modules/promise-queue/lib/index.js:109:18
From previous event:
    at Queue.add (/Users/mikami/.nodebrew/node/v9.7.0/lib/node_modules/serverless/node_modules/promise-queue/lib/index.js:94:16)
    at AwsProvider.request (/Users/mikami/.nodebrew/node/v9.7.0/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:237:39)
    at listStackResources (/MY_PRJ_DIR/node_modules/serverless-plugin-split-stacks/lib/utils.js:261:23)
    at ServerlessPluginSplitStacks.getStackSummary (/MY_PRJ_DIR/node_modules/serverless-plugin-split-stacks/lib/utils.js:273:12)
    at Promise.all.nestedStacks.map.stack (/MY_PRJ_DIR/node_modules/serverless-plugin-split-stacks/lib/migrate-existing-resources.js:19:21)
    at Array.map (<anonymous>)
    at getStackSummary.catch.then.then.nestedStacks (/MY_PRJ_DIR/node_modules/serverless-plugin-split-stacks/lib/migrate-existing-resources.js:15:39)
    at runCallback (timers.js:763:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)
    at process.topLevelDomainCallback (domain.js:101:23)
From previous event:
    at ServerlessPluginSplitStacks.getCurrentState [as migrateExistingResources] (/MY_PRJ_DIR/node_modules/serverless-plugin-split-stacks/lib/migrate-existing-resources.js:14:6)
    at Promise.resolve.then (/MY_PRJ_DIR/node_modules/serverless-plugin-split-stacks/split-stacks.js:54:24)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless

  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           9.7.0
     Serverless Version:     1.26.1

I have 54 funcitons which is combination of Lambda and API Gateway, and want to create more functions.
So decided to migrate from perType to perFunction strategy.
Using perFunction splitting from today.
First deployment is successfully done.
After that, I modify my code and try to update my stacks by sls deploy, but encountered the error.

Is this AWS's API limit exceeded?
Because this plugin is invoking CF's listStackResources API per nested stack at here.
I have 54 nested stack, so doing 54 API request in parallel.

Any ideas how can I fix?
or should I not use perFunction yet?

environemnt
serverless v1.26.1
serverless-plugin-split-stacks latest master branch
other plugin: serverless-webpack v4.2.0

Rate exceeded

Hi Folks!

I'm trying to build my project on CircleCI and I got this error:

Serverless: Invoke webpack:package
Serverless: Zip service: /home/ubuntu/project/.webpack/service [239 ms]
Serverless: Packaging service...
Serverless: Remove /home/ubuntu/project/.webpack
Serverless: Invoke aws:package:finalize

Serverless Error ---------------------------------------
 
  Rate exceeded
 
  Stack Trace --------------------------------------------
 
ServerlessError: Rate exceeded
    at BbPromise.fromCallback.catch.err (/home/ubuntu/project/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:258:33)
From previous event:
    at persistentRequest (/home/ubuntu/project/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:247:13)
    at doCall (/home/ubuntu/project/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:205:9)
    at BbPromise (/home/ubuntu/project/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:216:14)
From previous event:
    at persistentRequest (/home/ubuntu/project/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:203:38)
    at Object.request.requestQueue.add [as promiseGenerator] (/home/ubuntu/project/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:237:49)
    at Queue._dequeue (/home/ubuntu/project/node_modules/promise-queue/lib/index.js:149:30)
    at /home/ubuntu/project/node_modules/promise-queue/lib/index.js:156:26
From previous event:
    at Queue._dequeue (/home/ubuntu/project/node_modules/promise-queue/lib/index.js:151:18)
    at /home/ubuntu/project/node_modules/promise-queue/lib/index.js:108:18
From previous event:
    at Queue.add (/home/ubuntu/project/node_modules/promise-queue/lib/index.js:93:16)
    at AwsProvider.request (/home/ubuntu/project/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:237:39)
    at listStackResources (/home/ubuntu/project/node_modules/serverless-plugin-split-stacks/lib/utils.js:261:23)
    at ServerlessPluginSplitStacks.getStackSummary (/home/ubuntu/project/node_modules/serverless-plugin-split-stacks/lib/utils.js:273:12)
    at Promise.all.nestedStacks.map.stack (/home/ubuntu/project/node_modules/serverless-plugin-split-stacks/lib/migrate-existing-resources.js:19:21)
    at Array.map (native)
    at getStackSummary.catch.then.then.nestedStacks (/home/ubuntu/project/node_modules/serverless-plugin-split-stacks/lib/migrate-existing-resources.js:15:39)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
    at ServerlessPluginSplitStacks.getCurrentState [as migrateExistingResources] (/home/ubuntu/project/node_modules/serverless-plugin-split-stacks/lib/migrate-existing-resources.js:14:6)
    at Promise.resolve.then (/home/ubuntu/project/node_modules/serverless-plugin-split-stacks/split-stacks.js:67:24)
    at process._tickDomainCallback (internal/process/next_tick.js:135:7)
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless
 
  Your Environment Information -----------------------------
     OS:                     linux
     Node Version:           6.11.5
     Serverless Version:     1.26.1
 
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

yarn deploy --stage ${CIRCLE_BRANCH} --verbose returned exit code 1

Action failed: yarn deploy --stage ${CIRCLE_BRANCH} --verbose

My serverless.yml configuration:

splitStacks:
    perFunction: true
    perType: true

Any idea?

APINestedStack Error

An error occurred: APINestedStack - Template format error: Outputs count 62 is greater than max allowed 60.

I get this issue while using serverless deploy

Circular dependency? with serverless-dynamodb-autoscaling

So, I'm hesitant to call this an "issue", because it involves the interaction with another plugin ... but I do think there's something in here that this plugin might be doing that impacts this

 The CloudFormation template is invalid: Circular dependency between resources: [irhbackendDynamoDBAutoscaleRoleSa1b7044f5b423b64d61102be5d8c83c5, irhbackendDynamoDBAutoscaleRoleN4ab25b4fbf29412c02dd379d82952dd2, irhbackendDynamoDBAutoscaleRoleUsersDbUsersemailHayesUseast1, AutoScalingNestedStack, irhbackendDynamoDBAutoscaleRoleSbba38cfb55c552f9b350c918be2291b6, irhbackendDynamoDBAutoscaleRoleD4f2163618ad4c1b80636c6d627ecc261, irhbackendDynamoDBAutoscaleRoleEventsDbEventsactionHayesUseast1, irhbackendDynamoDBAutoscaleRoleEcff19f2ee2d2c7e5b48b4d8d1d61b33b, irhbackendDynamoDBAutoscaleRoleD2d8ed570c2612e39555a6291e51ddb5b, irhbackendDynamoDBAutoscaleRoleAf856b8abc3b1b56bfcf11910f71e64a0]

If you look at the pre- and post-files for this issue:
Nested Stacks.zip
Resource Limit.zip

I think what you're doing is that you replace the dependencies that a role like irhbackendDynamoDBAutoscaleRoleSbba38cfb55c552f9b350c918be2291b6 has upon the scaling targets and policies that have been placed in the AutoScalingNestedStack with a dependency upon the AutoScalingNestedStack itself. On the other hand, when you declare the AutoScalingNestedStack resource down below, it has dependencies back to irhbackendDynamoDBAutoscaleRoleSbba38cfb55c552f9b350c918be2291b6 because you are passing its ARN as a parameter.

I believe this problem has been created by the dynamodb-autoscaling plugin. I believe he has created non-necessary vertical dependencies in order to avoid rate-exceeded errors. I believe he should be creating non-necessary horizontal dependencies to create a similar slow-down, which would avoid this problem here.

But you might be able to help me with the next problem ... when I move the AutoScaling roles over into the NestedStack in stacks-map.js to avoid this circular dependency:

stacksMap['AWS::IAM::Role'] = {
  destination: (resourceName) => {
    if (/AutoscaleRole/.test(resourceName)) return 'AutoScaling';

    return null;
  },
};

I get the following error:
Error Message.txt

Unfortunately I don't have any config files to show you, they appear to not have been created properly. Can you see anything in my change to stacks-map.js that might cause this problem?

JavaScript heap out of memory

I can't deploy our API Gateway with this plugin. I can't give you our exact serverless file but it consists of 20 lambda functions with each one or more http events.


<--- Last few GCs --->

[8812:0x102801600]    69793 ms: Mark-sweep 1424.3 (1489.1) -> 1424.3 (1489.1) MB, 1788.9 / 0.0 ms  allocation failure GC in old space requested
[8812:0x102801600]    71544 ms: Mark-sweep 1424.3 (1489.1) -> 1424.1 (1459.1) MB, 1750.4 / 0.0 ms  last resort gc
[8812:0x102801600]    73306 ms: Mark-sweep 1424.1 (1459.1) -> 1424.1 (1459.1) MB, 1762.7 / 0.0 ms  last resort gc


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x27adb29c0d39 <JS Object>
    1: deepMapValuesIteratee(aka deepMapValuesIteratee) [/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:~52] [pc=0x3aa7105357a5](this=0x27adb2904311 <undefined>,value=0x30dd11b309c9 <an Object with map 0x3a3f1b279c09>,key=0xb56607fd0d1 <String[25]: part-exchange-pdf-service>)
    2: arguments adaptor frame: 3->2
    3: /* anonymous */ [/usr/local/lib/node_modules/serverless/nod...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/usr/local/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/usr/local/bin/node]
 3: v8::Utils::ReportOOMFailure(char const*, bool) [/usr/local/bin/node]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
 5: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/bin/node]
 6: v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
 7: 0x3aa710208506
[1]    8812 abort      serverless deploy --stage dev

I can't post my serverless file but if I can help with anything in troubleshooting this I'll try my best. Thanks!

Can't install on newer node version

When trying to install I get this error:

โ‡’ yarn add serverless-plugin-split-stacks
yarn add v1.7.0
[1/4] ๐Ÿ” Resolving packages...
โ ‚ serverless-plugin-split-stacks(node:11776) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[2/4] ๐Ÿšš Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=4 <=9".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

โ‡’ node -v
v10.6.0

Is it possible to migrate a deployed API to this plugin?

I'm getting errors around log-groups and functions already existing in the parent stack when i try and deploy with this plguin to an existing API.

Is this expected to work (and something is wrong with my setup), or do you have to remove and deploy clean?

Re-Creating of the REST API on every update.

Is there any work around for the Rest API being deleted and recreated with every deployment? Right now I have a script that pulls down the specific SDK package for the Rest API so that the API gets updated in my build process, but if the API ID is constantly changing the only solution is going to be to manually update that ID every time I update an endpoint.

Successfully deploy, but can't remove

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"
  }

Custom Stack with perFunction

Using a custom stack with perFunction, gives an error:

custom:
  splitStacks:
    perFunction: true
    perType: false
const ServerlessPluginSplitStacks = require('serverless-plugin-split-stacks');

ServerlessPluginSplitStacks.resolveMigration = function (resource, logicalId, serverless) {

    console.log(resource);
    console.log(logicalId);

    // Fallback to default:
    return this.stacksMap[resource.Type];
};
Serverless: Added DynamoDB Auto Scaling to CloudFormation!
{ Type: 'AWS::S3::Bucket',
  Properties: { AccelerateConfiguration: { AccelerationStatus: 'Suspended' } } }
ServerlessDeploymentBucket

  Type Error ---------------------------------------------

  Cannot read property 'AWS::S3::Bucket' of undefined

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Failed with serverless-plugin-warmup

A life saver plugin! Thank you for creating this.

This (version 1.6.0) worked great for me with perType option but I had to comment out serverless-plugin-warmup. With the warmup plugin, I am getting this error:

Serverless: Updating Stack...
Serverless: Checking Stack update progress...
..................................................................................
Serverless: Operation failed!
 
  Serverless Error ---------------------------------------
 
  An error occurred: WarmUpPluginLogGroup - /aws/lambda/security-pankajk-warmup-plugin already exists.

I tried changing the order of plugins in serverless.yml file:

plugins:
  - serverless-dotenv-plugin
  - serverless-webpack
  - serverless-plugin-split-stacks
  - serverless-plugin-warmup

and

plugins:
  - serverless-dotenv-plugin
  - serverless-webpack
  - serverless-plugin-warmup
  - serverless-plugin-split-stacks

but this didn't help. Only thing that worked was to completely take out the warmup plugin.

Other thing I noticed is that the base CF stack is not removed when the error was encountered.

Support encryption on custom deployment buckets

This plugin doesn't seem to support encryption of a custom serverless deployment bucket.

Given the following extract from a serverless config:

provider:
  name: aws
  runtime: nodejs6.10
  deploymentBucket:
    name: myAmazingDeploymentBucket
    serverSideEncryption: AES256

I would expect all put's to be encrypted. What actually happens is the deployment zip file and the compiled-cloudformation-template.json is encrypted but the nested stack files generated are not.

In my case I got cloudformation-template-Permissions-nested-stack.json and cloudformation-template-API-nested-stack.json files pushed up to the deployment bucket unencrypted.

Can't Specify Custom Deployment Bucket

When I specify a custom deployment bucket in provider.deploymentBucket; ie:

provider:
  deploymentBucket:
    name: $bucket
    serverSideEncryption: AES256 

I get:

The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [ServerlessDeploymentBucket] in the Resources block of the template

The easiest solution to this problem is to simply remove the provider.deploymentBucket property and use whatever the Serverless framework gives you, however, it would be nice if this plugin did not have this issue.

That being said, I don't understand any of the magic going on here, so that solution is good enough for us for now.

Undefined AWS::ApiGateway

Hi,

Since last release there has been the following error:

  Type Error ---------------------------------------------
 
  Cannot set property 'AWS::ApiGateway::Resource' of undefined

In stack-map.js we turn off creation of nested stack for ApiGateway:

const stacksMap = require('serverless-plugin-split-stacks').stacksMap;

//ignore Api-Gateway for nesting stacks
stacksMap['AWS::ApiGateway::Resource'] = undefined;
stacksMap['AWS::ApiGateway::RestApi'] = undefined;

Dynamodb creation limit [Feature]

There is another limit that I think the plugin can handle.

That is a limit of 10 table create at a time.

Also that is a limit to create table index:
An error occurred: TeamRookieDynamoDbTable - Subscriber limit exceeded: You have exceeded the maximum number of indexed tables that can be created simultaneously.

AWS answer:

We can increase your limit to a degree, but note that above 10, you might not always be able to achieve the full number of concurrent control plane operations, depending on which combination of operations you are doing at once. CreateTable requests with several Secondary Indexes, especially when each index has a "Projection" with many "NonKeyAttributes". If your systems are going to need to rely on a certain number of concurrent control plane operations (for example, if you are creating time series tables on a schedule), then be sure to test to ensure that your particular combination of table creates and deletes for your particular table configurations work as you expect.

Resources Count

Can you explain about how count works?


Serverless: [serverless-plugin-split-stacks]: Summary: 120 resources migrated in to 3 nested stacks
Serverless: [serverless-plugin-split-stacks]:    Resources per stack:
Serverless: [serverless-plugin-split-stacks]:    - (root): 190
Serverless: [serverless-plugin-split-stacks]:    - APINestedStack: 56
Serverless: [serverless-plugin-split-stacks]:    - PermissionsNestedStack: 30
Serverless: [serverless-plugin-split-stacks]:    - VersionsNestedStack: 34

Summary: 120 resources: Shouldnt this number be the total of all resources?

  • (root): 190: Is this number the total?

I really dont understand these numbers.

"Circular dependency between resources" when use lambda as cognito user pool trigger

This is not a bug, just a question. How can I deploy using the nested stacks by function but ignoring just a few functions?

I have a Cognito User Pool that uses lambda function to some triggers. Because all functions are separated into nested stacks, this causes circular dependency.

If these functions can be ignored to deploy in nested stacks, works.

It's possible to use "stacks-map.js" to ignore just some functions? Like that:

const FunctionsIgnoredToNestedStack = ["SyncCognitoWithDynamoDB"]
  .sort((name1, name2) => name2.length - name1.length);

const ignoredFunction = logicalId => FunctionsIgnoredToNestedStack
  .some(lambdaName => logicalId.startsWith(lambdaName));

const ServerlessPluginSplitStacks = require("serverless-plugin-split-stacks");

ServerlessPluginSplitStacks.resolveMigration = function(resource, logicalId, serverless) {
  return ignoredFunction(logicalId) ? { destination: "[WHAT_IS_THE_ROOT?]" } : null;
};

Force migration support

Conversation here: b1a32f1#r25984068

Moving resources between stacks is tricky, subject to race conditions and other stuff. That said, It should be possible to override the "stack affinity" logic and force a resource to go to a new stack.

Unresolved resource dependencies [ApiGatewayRestApi] in the Resources block

Hey, I installed the plugin and when I try to deploy I get this:

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: [serverless-plugin-split-stacks]: Summary: 87 resources migrated in to 3 nested stacks
Serverless: [serverless-plugin-split-stacks]:    Resources per stack:
Serverless: [serverless-plugin-split-stacks]:    - (root): 125
Serverless: [serverless-plugin-split-stacks]:    - APINestedStack: 24
Serverless: [serverless-plugin-split-stacks]:    - PermissionsNestedStack: 31
Serverless: [serverless-plugin-split-stacks]:    - VersionsNestedStack: 32
Serverless: Invoke aws:common:moveArtifactsToPackage
Serverless: Invoke aws:common:validate
Serverless: Merged stage variables into ApiGateway Deployment
Serverless: Invoke aws:deploy:deploy
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (13.75 MB)...
Serverless: Validating template...

  Error --------------------------------------------------

  The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [ApiGatewayRestApi] in the Resources block of the template

I am using serverless 1.21.1

Any ideas how can I fix this ?

Cannot read property 'serverSideEncryption' of undefined

When upgrading to 1.4.0 we get this error. 1.3.2 is working for us in the meantime.

Serverless: Invoke aws:deploy:deploy
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (50.2 MB)...
 
  Type Error ---------------------------------------------
 
  Cannot read property 'serverSideEncryption' of undefined
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  Stack Trace --------------------------------------------
 
TypeError: Cannot read property 'serverSideEncryption' of undefined
    at encryptionFields.reduce ([...]/node_modules/serverless-plugin-split-stacks/lib/utils.js:289:33)
    at Array.reduce (native)
    at ServerlessPluginSplitStacks.getEncryptionParams ([...]/node_modules/serverless-plugin-split-stacks/lib/utils.js:288:29)
    at Promise.all._.map.file ([...]/node_modules/serverless-plugin-split-stacks/split-stacks.js:92:43)
    at arrayMap ([...]/node_modules/lodash/lodash.js:631:23)
    at Function.map ([...]/node_modules/lodash/lodash.js:9546:14)
    at provider.getServerlessDeploymentBucketName.then.deploymentBucket ([...]/node_modules/serverless-plugin-split-stacks/split-stacks.js:83:30)

Plugin introduces new scaling limit of 60 unique paths?

I'm experiencing an issue with the AWS "60 Outputs" limitation.
In APINestedStack-#####, this plugin is creating one Output per ApiGateway path (not per lambda).
So for example "GET /foo" creates one Output "ApiGatewayResourceFoo" and "GET /foo/{id}" creates another Output "ApiGatewayResourceFooIdVar". But then adding "PUT /foo/{id}" or "POST /foo" doesn't add any more, since it's related to the number of paths not the number of functions.

Our API is fairly complex and has exceeded 60 unique paths. Am looking at workarounds but also wondering if these ApiGateway Output objects are needed, and/or if they all have to be in one stack or if they could be split into the nested stacks?

Using the plugin

Hi there,
Are there any special commands or config needed to use this other than installing the plugin and referencing it in serverless.yml?

Did just that and noticed no difference on running sls deploy
From running it without the plugin (aka stack did not split)

Outputs count X is greater than max allowed 60.

Have been running into the 200 stack limit and my solution to it was manually maintaining a swagger doc file and manually updating it. Attempted to use this plugin and ran into an issue listed below, if you need any more information from me, just ask. Cheers

Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: [serverless-plugin-split-stacks]: Summary: 99 resources migrated in to 3 nested stacks
Serverless: [serverless-plugin-split-stacks]: Resources per stack:
Serverless: [serverless-plugin-split-stacks]: - (root): 167
Serverless: [serverless-plugin-split-stacks]: - APINestedStack: 97
Serverless: [serverless-plugin-split-stacks]: - PermissionsNestedStack: 1
Serverless: [serverless-plugin-split-stacks]: - VersionsNestedStack: 1
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (37.36 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
.....
Serverless: Operation failed!

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

An error occurred: APINestedStack - Template format error: Outputs count 81 is greater than max allowed 60.

Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless

Your Environment Information -----------------------------
OS: win32
Node Version: 6.10.2
Serverless Version: 1.23.0

Sub Nested Stacks

Hello! Is there currently a way to define sub nested stacks of an already nested stacked with this plugin?

  • root
    --- Nested Stack A (child of root)
    ----- Nested Stack B (child of Nested Stack A)

Similar to the AWS diagram found here
screen shot 2018-10-17 at 4 39 50 pm

Thanks a bunch!

Stack affinity?

  • Read current state to find resources that are already on a given stack (avoid resources jumping around)
  • Allow explicit stack association via serverless.yml

Moving AWS::ApiGateway::RestApi out of root stack breaks plugin serverless-domain-manager

When using serverless-plugin-split-stacks together with serverless-domain-manager, deployment fails with:

  Error --------------------------------------------------

  Error: Failed to find CloudFormation resources for <my domain>

serverless-domain-manager expects the resource AWS::ApiGateway::RestApi to be in the root stack.

A simple fix is to prevent it from being moved to a nested stack, using:
stacks-map.js

module.exports = {
  'AWS::ApiGateway::RestApi': false,
};

It seems that similar issues are caused by moving AWS::ApiGateway::RestApi to a nested stack, see #24 and #9.

CloudFormation template is invalid: Number of resources, 207

Hello,

I've used this plugin to split my big AppSync service stack.
But it's not splitting my stack.

Getting same error: resource limit issue of CFN.

I've used perType mode for splitting.
But it just migrated some Lambda versions only to nested stack. (only 4 resources)

Can you help me and guide how to use this plugin with appsync-serverless-plugin?
Thanks

Unable to Delete Rest API that is mapped to a custom domain

When running a deploy for a Rest API if that API is using a custom domain the stack deleting fails because all of the base paths must be removed before it can be deleted. However, it did delete all of the resources.

It would be nice to have an option to make is o the current API doesn't get deleted when deploying so that you can gracefully switch from the old API to the new one without losing service.

plugin appears to be removing VPC configuration from functions?

When I run a 'package' command without this plugin, the vpc: configuration on a function appears to go through to the resultling package.

When I turn the plugin on, I cannot find the vpc config on the functions in the resulting package at all.

If I deploy the resulting package with the plugin turned on, the vpc configuration is not set in AWS.

Could it be that there's an oddity in function migration?

Migration Strategies default change

Hi @dougmoscrop ,
Thanks for the awesome plugin! it made our life simple. We tested this plugin with our serverless deployments and worked great!
Just wanted to know one thing, in Migration Strategies you have mentioned that Per Lambda - This defaults to off in 1.x but will switch to enabled by default in 2.x.
Is there any specific reason to change the default behavior?

Thanks,
Mahesh

"Embedded stack [...] was not successfully created: The following resource(s) failed to create: [..., ..., ...]

Hey there,

I have an existing stack with one function without your plugin installed or configured. The function has no events as input although having tested with and without events this makes no difference.

The current version of your plugin I'm using is [email protected] but I initially encountered this issue on 1.3.2 (the oldest version I've used). I have also tested running the serverless deploy command using both v6.10.3 and v10.10.0 of nodejs (on Ubuntu 18.04). The serverless runtime that I've targetted is nodejs6.10 on AWS. The serverless installation I have locally is version 1.3.2 for both v6 and v10 of nodejs.

After setting up and deploying a function using serverless I update my configuration with the following:

plugins:
  - serverless-plugin-split-stacks
custom:
  splitStacks:
    perFunction: true
    perType: false

And of course have the package installed via NPM (a local installation, not global).

Here is the command I issue once I've installed your plugin and the response (with SLS_DEBUG set to true):

$ serverless deploy --stage dev
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 login
Serverless: Load command logout
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: [serverless-plugin-split-stacks]: Summary: 3 resources migrated in to 1 nested stacks
Serverless: [serverless-plugin-split-stacks]:    Resources per stack:
Serverless: [serverless-plugin-split-stacks]:    - (root): 3
Serverless: [serverless-plugin-split-stacks]:    - [REDACTED]NestedStack: 3
Serverless: Invoke aws:common:moveArtifactsToPackage
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:deploy:deploy
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (22.2 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
........
Serverless: Operation failed!
 
  Serverless Error ---------------------------------------
 
  An error occurred: [REDACTED]NestedStack - Embedded stack arn:aws:cloudformation:[REDACTED] was not successfully created: The following resource(s) failed to create: [[REDACTED]LogGroup]. .
 
  Stack Trace --------------------------------------------
 
ServerlessError: An error occurred: [REDACTED]NestedStack - Embedded stack arn:aws:cloudformation:[REDACTED] was not successfully created: The following resource(s) failed to create: [[REDACTED]LogGroup]. .
    at provider.request.then (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/plugins/aws/lib/monitorStack.js:112:33)
From previous event:
    at AwsDeploy.monitorStack (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/plugins/aws/lib/monitorStack.js:26:12)
    at provider.request.then (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/plugins/aws/lib/updateStack.js:95:30)
From previous event:
    at AwsDeploy.update (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/plugins/aws/lib/updateStack.js:95:8)
From previous event:
    at AwsDeploy.BbPromise.bind.then (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/plugins/aws/lib/updateStack.js:112:12)
From previous event:
    at AwsDeploy.updateStack (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/plugins/aws/lib/updateStack.js:106:8)
From previous event:
    at AwsDeploy.BbPromise.bind.then (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:129:39)
From previous event:
    at Object.aws:deploy:deploy:updateStack [as hook] (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:125:10)
    at BbPromise.reduce (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/classes/PluginManager.js:390:55)
From previous event:
    at PluginManager.invoke (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/classes/PluginManager.js:390:22)
    at PluginManager.spawn (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/classes/PluginManager.js:408:17)
    at AwsDeploy.BbPromise.bind.then (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:95:48)
From previous event:
    at Object.deploy:deploy [as hook] (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:91:10)
    at BbPromise.reduce (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/classes/PluginManager.js:390:55)
From previous event:
    at PluginManager.invoke (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/classes/PluginManager.js:390:22)
    at PluginManager.run (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/classes/PluginManager.js:421:17)
    at variables.populateService.then.then (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/Serverless.js:157:33)
    at runCallback (timers.js:694:18)
    at tryOnImmediate (timers.js:665:5)
    at processImmediate (timers.js:647:5)
    at process.topLevelDomainCallback (domain.js:121:23)
From previous event:
    at Serverless.run (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/lib/Serverless.js:144:8)
    at serverless.init.then (/home/[REDACTED]/.nvm/versions/node/v10.10.0/lib/node_modules/serverless/bin/serverless:43:50)
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information -----------------------------
     OS:                     linux
     Node Version:           10.10.0
     Serverless Version:     1.32.0

It is not consistent with what resource it fails at. The resource type varies as well, especially once I ramp up the number of functions I try to run this configuration against. *LambdaFunctionRole, *LogGroup and ApiGatewayResource* have all come up at the same time, for different resources. It will be (seemingly) random resources and resource groups that 'cause' the error each time although with just one Lambda it seems to always be the *LogGroup resource that fails.

I already use your plugin with the default stack per resource type configuration and it works great but I recently hit the limit on role policy length for the serverless Lambda role so wanted to additionally add the serverless-plugin-custom-roles plugin to have a role per function. This meant I needed to split my configuration further and if I can use a stack per Lambda that would make my life super easy for the foreseeable future.

This is a very useful plugin btw. If you want more information I'd be happy to provide it but I'm new to the serverless framework so I'm not sure what's useful to you right now, or even if it's a bug and not me doing something stupid (I think stupidity is more likely but I've been fighting this for a couple of days now and don't understand what I've done wrong).

I have tried to do this on an existing stack with more than 200 functions by changing the config for your plugin without adding or removing functions. Then I tried stripping back the config to ~180 functions and removing your plugin before trying to re-enable the plugin with the above configuration before finally moving all the way down to a single function.

[v1.5.2] FiltersNestedStack create fails when DestinationArn uses Fn::Join

I suspect this split-stacks plugin is to blame, but it could be dougmoscrop's other plugin at fault.
If so, I can move/repost this issue there.

TL;DR

There is a new issue with either this plugin or serverless-plugin-log-subscription's ability to process Fn::Join based values for SubscriptionFilter resource's destinationArn and roleArn properties.

Issue Details

I've got an existing app using serverless-plugin-log-subscription and this split-stacks plugin, and when trying to re-deploy recently, the deploy fails when trying to create a new FiltersNestedStack:

CloudFormation - CREATE_FAILED - AWS::CloudFormation::Stack - FiltersNestedStack

Previously, the split-stacks logic resulted in two nested stacks: APINestedStack and PermissionsNestedStack.

The last successful deploy's stack summary looked like:

Serverless: [serverless-plugin-split-stacks]: Summary: 46 resources migrated in to 2 nested stacks
Serverless: [serverless-plugin-split-stacks]:    Resources per stack:
Serverless: [serverless-plugin-split-stacks]:    - (root): 89
Serverless: [serverless-plugin-split-stacks]:    - APINestedStack: 29
Serverless: [serverless-plugin-split-stacks]:    - PermissionsNestedStack: 17

I added a new lambda APIGateway endpoint, so not sure if that changed the logic to decide somehow that a third, nested stack for the filters was necessary?

Regardless, I started seeing this error in the serverless deploy results (some sensitive data removed):

Serverless: Operation failed!

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

  An error occurred: FiltersNestedStack - Embedded stack arn:aws:cloudformation:us-west-2:{AWS_ACCOUNT_ID}:stack/{ROOT_STACK_NAME}-FiltersNestedStack-11M30I1UE4Y79/ac9aa190-650f-11e8-a65a-50a68d01a6c5 was not successfully created: The following resource(s) failed to create: [LIST_OF_ALL_SUBSCRIPTIONFILTER_RESOURCES]. .

Checking CloudFormation on AWS Console, I saw a bit more detail... next to each SubscriptionFilter, this error was listed:

10:43:23 UTC-0700 | CREATE_FAILED | AWS::Logs::SubscriptionFilter | GetRewardInventorySubscriptionFilter | Value of property DestinationArn must be of type String

The config for my logSubscription plugin is:

logSubscription:
  enabled: true
  destinationArn:
    Fn::Join:
      - ':'
      - - 'arn:aws:kinesis:us-west-2'
        - Ref: 'AWS::AccountId'
        - 'stream/splunk-cw-stream'
  roleArn:
    Fn::Join:
      - ':'
      - - 'arn:aws:iam:'
        - Ref: 'AWS::AccountId'
        - 'role/splunk-cw-role'

The processed .json file for the FiltersNestedStack template in .serverless directory had the proper JSON equivalent, but seemed a bit strange. It processed the value for the first SubscriptionFilter resource, then all subsequent resources just reference that value.
( Again, edited a bit for sensitive project-based data )
Notice the "$ref" value for the second resource's destinationArn:

// .serverless/cloudformation-template-Filters-nested-stack.json
{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "FiltersNestedStack nested stack",
  "Parameters": {},
  "Resources": {
    "AuthorizerFuncSubscriptionFilter": {
      "Type": "AWS::Logs::SubscriptionFilter",
      "Properties": {
        "DestinationArn": {
          "Fn::Join": [
            ":",
            [
              "arn:aws:kinesis:us-west-2",
              {
                "Ref": "AWS::AccountId"
              },
              "stream/splunk-cw-stream"
            ]
          ]
        },
        "FilterPattern": "",
        "LogGroupName": "/aws/lambda/{stack}-authorizerFunc",
        "RoleArn": {
          "Fn::Join": [
            ":",
            [
              "arn:aws:iam:",
              {
                "Ref": "AWS::AccountId"
              },
              "role/splunk-cw-role"
            ]
          ]
        }
      },
      "DependsOn": []
    },
    "CheckinDashgetSubscriptionFilter": {
      "Type": "AWS::Logs::SubscriptionFilter",
      "Properties": {
        "DestinationArn": {
          "$ref": "$[\"Resources\"][\"AuthorizerFuncSubscriptionFilter\"][\"Properties\"][\"DestinationArn\"]"
        },
        "FilterPattern": "",
        "LogGroupName": "/aws/lambda/{stack}-checkin-get",
        "RoleArn": {
          "$ref": "$[\"Resources\"][\"AuthorizerFuncSubscriptionFilter\"][\"Properties\"][\"RoleArn\"]"
        }
      },
      "DependsOn": []
    },
    ...

To troubleshoot, I hardcoded the final ARN value I wanted into the logSubscription config, suspecting an issue with the AWS functions to assemble the final string.
After re-deploy with a string literal value for destinationArn, I got the same error for all SubscriptionFilter resources, but this time complaining that Value of property RoleArn must be of type String.
I repeated the hard-coding step for roleArn, and the deploy was successful.

The final, new successful deploy stack summary (with hard coded string values for destinationArn and roleArn) is:

Serverless: [serverless-plugin-split-stacks]: Summary: 68 resources migrated in to 3 nested stacks
Serverless: [serverless-plugin-split-stacks]:    Resources per stack:
Serverless: [serverless-plugin-split-stacks]:    - (root): 76
Serverless: [serverless-plugin-split-stacks]:    - APINestedStack: 32
Serverless: [serverless-plugin-split-stacks]:    - FiltersNestedStack: 18
Serverless: [serverless-plugin-split-stacks]:    - PermissionsNestedStack: 

Not sure what a good workaround/solution is...

I tried using a Fn::Sub solution instead, but got this error:

Invalid variable reference syntax for variable AWS::AccountId. You can only reference env vars, options, & files. You can check our docs for more info.

I guess I could set a temporary option variable that references the AccountId, but that seems hacky.
I'd much prefer the Fn::Join call works as it used to.

Any ideas?

Maximum policy size error

Deploying a sizeable serverless application, we had first hit the cap of 200 resources. This plugin solved that issue but possibly introduced another one later on:

An error occurred: IamRoleLambdaExecution - Maximum policy size of 10240 bytes exceeded for role beekeeper-serverless-staging-eu-west-1-lambdaRole.

screen shot 2018-01-26 at 11 22 39

It's an issue already reported with core serverless/serverless#2508 but looking at .serverless, I'm wondering if it's not the way we split the stacks that does this. I assume that the definition of permissions is in .serverless/cloudformation-template-Permissions-nested-stack.json which is very verbose and is 37KB in our project (which is 27KB over the aws threshold).

Do you have any recommendations on what to do when we hit this issue?

CloudFormation - CREATE_FAILED - AWS::CloudFormation::Stack - APINestedStack

Hello
I'm trying to execute this command, but it always returns this error:

CloudFormation - CREATE_FAILED - AWS::CloudFormation::Stack - APINestedStack

My application is growing, I do not know how to make this work.

The serverless.yml

serverless.yml.zip

And the complete output is

`$ sls deploy --stage prod -v
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: [serverless-plugin-split-stacks]: Summary: 124 resources migrated in to 3 nested stacks
Serverless: [serverless-plugin-split-stacks]: Resources per stack:
Serverless: [serverless-plugin-split-stacks]: - (root): 165
Serverless: [serverless-plugin-split-stacks]: - APINestedStack: 44
Serverless: [serverless-plugin-split-stacks]: - PermissionsNestedStack: 40
Serverless: [serverless-plugin-split-stacks]: - VersionsNestedStack: 40
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - phinics-prod
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_COMPLETE - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_COMPLETE - AWS::CloudFormation::Stack - phinics-prod
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service phinics.zip file to S3 (31.15 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
CloudFormation - UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - phinics-prod
CloudFormation - CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetNotificationLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetStudyLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::DynamoDB::Table - InstitutionsDynamoDBTable
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetPlanLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetEventByIdLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::DynamoDB::Table - NotificationDynamoDBTable
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - CreateUserLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetUserLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - UpdatePlanLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - DeleteUserLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - DeleteStudyLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - GetNotificationListLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::DynamoDB::Table - StudyDynamoDBTable
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - DownloadStudyLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - ResendverifyLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - UpdateNotificationLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - CreateStudyLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - UnBlockUserLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::DynamoDB::Table - ProffesionalsDynamoDBTable
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - UsersListLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::DynamoDB::Table - PersonsDynamoDBTable
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - DeleteEventLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetEventsListLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - EditStudyLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetProfileLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - GetNotificationLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - EditEventLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - ListPlanLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - GetPlanLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetNewNotificationLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - UpdateUserLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetPersonsLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::DynamoDB::Table - PlansDynamoDBTable
CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - APINestedStack
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetHistoryLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - EditEventLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - EditStudyLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - CreateNotificationLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - ResetUserPasswordLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::DynamoDB::Table - UsersDynamoDBTable
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - DeletePersonLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - ListPlanLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetPersonLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - UpdatePersonLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - UpdateUserLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - UploadStudyLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - GetPersonsLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::DynamoDB::Table - EventDynamoDBTable
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - LoginUserLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - ResetUserPasswordLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - ForgottenpasswordLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - DeletePersonLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - GetHistoryLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - CreateNotificationLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - GetPersonLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - UploadStudyLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - BlockUserLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - UpdatePersonLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - VerifyUserLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - AddPersonLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - DeleteNotificationLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - CreateEventLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - CreatePlanLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - DeleteEventLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - CreateStudyLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetEventByIdLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::DynamoDB::Table - CountersTable
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - UsersListLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - DeleteUserLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::DynamoDB::Table - StudyDynamoDBTable
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - ForgottenpasswordLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetEventsListLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - UpdateNotificationLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - VerifyUserLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - DeleteNotificationLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetProfileLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - BlockUserLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetUserLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - CreateStudyLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - DeleteEventLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - LoginUserLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - CreateEventLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - GetEventByIdLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - DeleteUserLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetNewNotificationLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - UpdateNotificationLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - UsersListLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - GetEventsListLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - CreatePlanLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - GetProfileLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetStudyLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - GetUserLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - GetNewNotificationLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - AddPersonLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - GetStudyLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::DynamoDB::Table - CountersTable
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - AddPersonLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - APINestedStack
CloudFormation - CREATE_COMPLETE - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - CREATE_FAILED - AWS::CloudFormation::Stack - APINestedStack
CloudFormation - CREATE_FAILED - AWS::DynamoDB::Table - PlansDynamoDBTable
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Function - UsersListLambdaFunction
CloudFormation - CREATE_FAILED - AWS::DynamoDB::Table - StudyDynamoDBTable
CloudFormation - CREATE_FAILED - AWS::DynamoDB::Table - PersonsDynamoDBTable
CloudFormation - CREATE_FAILED - AWS::DynamoDB::Table - ProffesionalsDynamoDBTable
CloudFormation - CREATE_FAILED - AWS::Lambda::Function - UsersListLambdaFunction
CloudFormation - CREATE_FAILED - AWS::DynamoDB::Table - CountersTable
CloudFormation - CREATE_FAILED - AWS::DynamoDB::Table - UsersDynamoDBTable
CloudFormation - CREATE_FAILED - AWS::DynamoDB::Table - InstitutionsDynamoDBTable
CloudFormation - CREATE_FAILED - AWS::DynamoDB::Table - EventDynamoDBTable
CloudFormation - CREATE_FAILED - AWS::Lambda::Function - GetNotificationListLambdaFunction
CloudFormation - CREATE_FAILED - AWS::DynamoDB::Table - NotificationDynamoDBTable
CloudFormation - UPDATE_ROLLBACK_IN_PROGRESS - AWS::CloudFormation::Stack - phinics-prod
CloudFormation - UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - phinics-prod
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - UploadStudyLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - ListPlanLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - GetEventsListLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - GetNewNotificationLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - DeleteStudyLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - GetPersonLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - EditEventLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - GetProfileLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - GetNotificationLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - DeleteEventLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - ForgottenpasswordLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - GetUserLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::CloudFormation::Stack - APINestedStack
CloudFormation - DELETE_IN_PROGRESS - AWS::DynamoDB::Table - EventDynamoDBTable
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - EditStudyLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::DynamoDB::Table - CountersTable
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - LoginUserLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - DownloadStudyLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - DeleteNotificationLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - DeletePersonLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - BlockUserLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Lambda::Function - GetNotificationListLambdaFunction
CloudFormation - DELETE_COMPLETE - AWS::Lambda::Function - UsersListLambdaFunction
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - ResetUserPasswordLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - GetHistoryLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - UpdatePlanLogGroup
CloudFormation - DELETE_SKIPPED - AWS::DynamoDB::Table - ProffesionalsDynamoDBTable
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - ResendverifyLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - GetPersonsLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::DynamoDB::Table - StudyDynamoDBTable
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - CreateStudyLogGroup
CloudFormation - DELETE_SKIPPED - AWS::DynamoDB::Table - InstitutionsDynamoDBTable
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - UpdateUserLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - AddPersonLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - CreateNotificationLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::DynamoDB::Table - NotificationDynamoDBTable
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - CreatePlanLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - GetPlanLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - UnBlockUserLogGroup
CloudFormation - DELETE_SKIPPED - AWS::DynamoDB::Table - PersonsDynamoDBTable
CloudFormation - DELETE_SKIPPED - AWS::DynamoDB::Table - PlansDynamoDBTable
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - GetEventByIdLogGroup
CloudFormation - DELETE_SKIPPED - AWS::DynamoDB::Table - UsersDynamoDBTable
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - VerifyUserLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - UpdatePersonLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - CreateEventLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - GetStudyLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - GetEventsListLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - UploadStudyLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - ListPlanLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - GetPersonLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - GetNewNotificationLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - CreateUserLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - DeletePersonLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - CreateEventLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - CreateUserLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - UpdateNotificationLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - DeleteUserLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - DeleteStudyLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - EditStudyLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - EditEventLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - DeleteNotificationLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - GetProfileLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - DownloadStudyLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - ForgottenpasswordLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - LoginUserLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - GetNotificationLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - DeleteEventLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - UpdatePlanLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - GetUserLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - GetHistoryLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - CreatePlanLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - ResendverifyLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - CreateNotificationLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - GetPersonsLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - BlockUserLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - GetPlanLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - ResetUserPasswordLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - GetEventByIdLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - CreateStudyLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - AddPersonLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - UnBlockUserLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - UpdatePersonLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - VerifyUserLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - UpdateUserLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - GetStudyLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - GetNotificationListLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::Logs::LogGroup - UsersListLogGroup
CloudFormation - DELETE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - UpdateNotificationLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - GetNotificationListLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - DeleteUserLogGroup
CloudFormation - DELETE_COMPLETE - AWS::Logs::LogGroup - UsersListLogGroup
CloudFormation - DELETE_COMPLETE - AWS::CloudFormation::Stack - APINestedStack
CloudFormation - DELETE_COMPLETE - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - DELETE_COMPLETE - AWS::DynamoDB::Table - NotificationDynamoDBTable
CloudFormation - DELETE_COMPLETE - AWS::DynamoDB::Table - StudyDynamoDBTable
CloudFormation - DELETE_COMPLETE - AWS::DynamoDB::Table - EventDynamoDBTable
CloudFormation - DELETE_COMPLETE - AWS::DynamoDB::Table - CountersTable
CloudFormation - UPDATE_ROLLBACK_COMPLETE - AWS::CloudFormation::Stack - phinics-prod
Serverless: Operation failed!
Serverless: View the full error output: https://us-west-2.console.aws.amazon.com/cloudformation/home?region=us-west-2#/stack/detail?stackId=arn%3Aaws%3Acloudformation%3Aus-west-2%3A121770887788%3Astack%2Fphinics-prod%2F503adf50-8697-11e9-af5f-027fe4f7c9fc

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

An error occurred: APINestedStack - Embedded stack arn:aws:cloudformation:us-west-2:121770887788:stack/phinics-prod-APINestedStack-15JUKI9WEGC42/7d5ecfa0-8697-11e9-9ef7-0211d8bec7e2 was not successfully created: The following resource(s) failed to create: [ApiGatewayResourceApiUserForgottenpassword, ApiGatewayResourceApiUserMembers, ApiGatewayResourceApiUserLogin, ApiGatewayResourceApiNotificationIdVar, ApiGatewayResourceApiUserResendverify, ApiGatewayResourceApiEventList, ApiGatewayResourceApiStudyUpload, ApiGatewayResourceApiAdminUser, ApiGatewayResourceApiPersonPersonVar, ApiGatewayResourceApiEventIdVar]. .

Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com

Your Environment Information ---------------------------
OS: linux
Node Version: 8.10.0
Serverless Version: 1.40.0
`
I hope that you can help me

Issue with version 1.3.0

Having an issue with the latest version. This is the log is spitting out on my build server.

  Type Error ---------------------------------------------

  Cannot use 'in' operator to search for 'Fn::GetAtt' in xxxxxxxx

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Stack Trace --------------------------------------------

TypeError: Cannot use 'in' operator to search for 'Fn::GetAtt' in xxxxxx
at Reference.getDependencyName (/home/rof/src/bitbucket.org/healthtalks/xxxxxxxxxxx/node_modules/serverless-plugin-split-stacks/lib/reference.js:10:22)
at Object.ResourceMigrated (/home/rof/src/bitbucket.org/healthtalks/xxxxxxxxxxx/node_modules/serverless-plugin-split-stacks/lib/replace-references.js:19:55)
at ServerlessPluginSplitStacks.reconcile (/home/rof/src/bitbucket.org/healthtalks/xxxxxxxxxxx/node_modules/serverless-plugin-split-stacks/lib/utils.js:236:25)
at _.each.dependency (/home/rof/src/bitbucket.org/healthtalks/xxxxxxxxxxx/node_modules/serverless-plugin-split-stacks/lib/replace-references.js:16:12)
at arrayEach (/home/rof/src/bitbucket.org/healthtalks/xxxxxxxxxxx/node_modules/lodash/lodash.js:537:11)
at Function.forEach (/home/rof/src/bitbucket.org/healthtalks/xxxxxxxxxxx/node_modules/lodash/lodash.js:9359:14)
at _.each (/home/rof/src/bitbucket.org/healthtalks/xxxxxxxxxxx/node_modules/serverless-plugin-split-stacks/lib/replace-references.js:15:7)
at /home/rof/src/bitbucket.org/healthtalks/xxxxxxxxxxx/node_modules/lodash/lodash.js:4944:15
at baseForOwn (/home/rof/src/bitbucket.org/healthtalks/xxxxxxxxxxx/node_modules/lodash/lodash.js:3001:24)
at /home/rof/src/bitbucket.org/healthtalks/xxxxxxxxxxx/node_modules/lodash/lodash.js:4913:18
at Function.forEach (/home/rof/src/bitbucket.org/healthtalks/xxxxxxxxxxx/node_modules/lodash/lodash.js:9359:14)
at ServerlessPluginSplitStacks.replaceReferences (/home/rof/src/bitbucket.org/healthtalks/xxxxxxxxxxx/node_modules/serverless-plugin-split-stacks/lib/replace-references.js:6:5)
at Promise.resolve.then.then.then (/home/rof/src/bitbucket.org/healthtalks/xxxxxxxxxxx/node_modules/serverless-plugin-split-stacks/split-stacks.js:69:24)
at <anonymous>
From previous event:
at PluginManager.invoke (/home/rof/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/classes/PluginManager.js:366:22)
at PluginManager.spawn (/home/rof/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/classes/PluginManager.js:384:17)
at AwsPackage.BbPromise.bind.then (/home/rof/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/plugins/aws/package/index.js:69:51)
From previous event:
at Object.package:finalize [as hook] (/home/rof/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/plugins/aws/package/index.js:69:10)
at BbPromise.reduce (/home/rof/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/classes/PluginManager.js:366:55)
From previous event:
at PluginManager.invoke (/home/rof/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/classes/PluginManager.js:366:22)
at PluginManager.spawn (/home/rof/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/classes/PluginManager.js:384:17)
at Deploy.BbPromise.bind.then.then (/home/rof/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:120:50)
From previous event:
at Object.before:deploy:deploy [as hook] (/home/rof/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:110:10)
at BbPromise.reduce (/home/rof/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/classes/PluginManager.js:366:55)
From previous event:
at PluginManager.invoke (/home/rof/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/classes/PluginManager.js:366:22)
at PluginManager.run (/home/rof/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/classes/PluginManager.js:397:17)
at variables.populateService.then (/home/rof/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/Serverless.js:104:33)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
at Serverless.run (/home/rof/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/Serverless.js:91:74)
at serverless.init.then (/home/rof/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/bin/serverless:42:50)
at <anonymous>

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless

  Your Environment Information -----------------------------
     OS:                     linux
     Node Version:           8.9.1
     Serverless Version:     1.24.1

Crashes on node v12

In the below code we check for error.message to end with the customPath.

if (e.code !== 'MODULE_NOT_FOUND' || !e.message.endsWith(`'${customPath}'`)) {

But starting with node.js v12, for MODULE_NOT_FOUND errors the error message also includes the require stack (nodejs/node#25690), which breaks the expected behavior that we want.

// e.message before node v12
"Cannot find module '/<serviceDirectory>/stacks-map.js'"
// e.message in node v12
"Cannot find module '/<serviceDirectory>/stacks-map.js'
Require stack:
- /<serviceDirectory>/node_modules/serverless-plugin-split-stacks/lib/migration-strategy/custom.js
- /<serviceDirectory>/node_modules/serverless-plugin-split-stacks/lib/migrate-new-resources.js
- /<serviceDirectory>/node_modules/serverless-plugin-split-stacks/split-stacks.js
- /<serviceDirectory>/node_modules/serverless/lib/classes/PluginManager.js
- /<serviceDirectory>/node_modules/serverless/lib/Serverless.js
- /<serviceDirectory>/node_modules/serverless/lib/utils/autocomplete.js
- /<serviceDirectory>/node_modules/serverless/bin/serverless"

Hitting CloudFormation template maximum size

Dear Author,
I deployed successfully with the plugin.
But now when I add more APIs in serverless.yml. I receive this error.
" The CloudFormation template is invalid: Template may not exceed 460800 bytes in size."

I'm using serverless framwork with version 1.32.
Do you have any ideas?

Error occurred when deploy

The scenario is:
In my previous deploy, I use the default configuration which is perFunction: false perType: true, but I still got the 200 resource exceeding error. So I modify the config to
perFunction: true perType: true. Then I got the error like:
An error occurred: DailyDashscheduleDashreportNestedStack - Embedded stack arn:aws:cloudformation:us-east-1:${ARNNAME}:stack/${projectName}-DailyDashscheduleDashreportNestedStack-7V01KEDLHJ9X/a66c33f0-4cc8-11e9-a380-0a456a010dd4 was not successfully created: The following resource(s) failed to create: [DailyDashscheduleDashreportLambdaFunctionRole, DailyDashscheduleDashreportLogGroup]. .

What is the proper way to solve this? By advance usage by Stack-map.js or something else?

Appreicate to help of anykinds.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.