Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(CLI): Introduce modern warning about resource limit #10086

Merged
merged 2 commits into from
Oct 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/plugins/aws/info/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const getStackInfo = require('./getStackInfo');
const getResourceCount = require('./getResourceCount');
const getApiKeyValues = require('./getApiKeyValues');
const display = require('./display');
const { log } = require('@serverless/utils/log');

const mainProgress = progress.get('main');

Expand Down Expand Up @@ -72,11 +73,22 @@ class AwsInfo {
'aws:info:displayStackOutputs': async () =>
BbPromise.bind(this).then(this.displayStackOutputs),

'after:aws:info:gatherData': () => {
if (this.gatheredData && this.gatheredData.info.resourceCount >= 450) {
log.warning(
`You have ${
this.gatheredData.info.resourceCount
} resources in your service. CloudFormation has a hard limit of 500 resources in a service. For advice on avoiding this limit, check out this link: ${style.link(
'http://slss.io/2q2'
)}.`
);
}
},

'finalize': () => {
if (this.serverless.processedInput.commands.join(' ') !== 'info') return;

writeText(
null,
`${style.aside('service:')} ${this.serverless.service.service}`,
`${style.aside('stage:')} ${this.provider.getStage()}`,
`${style.aside('region:')} ${this.provider.getRegion()}`,
Expand Down