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

fix: validate that the app limit has not been reached (issue #10063) #10158

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions packages/amplify-cli/src/init-steps/s9-onSuccess.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
import * as fs from 'fs-extra';
import { join } from 'path';
import sequential from 'promise-sequential';
import { CLIContextEnvironmentProvider, FeatureFlags, pathManager, stateManager, $TSContext } from 'amplify-cli-core';
import {
CLIContextEnvironmentProvider, FeatureFlags, pathManager, stateManager, $TSContext,
} from 'amplify-cli-core';
import _ from 'lodash';
import { printer } from 'amplify-prompts';
import { getFrontendPlugins } from '../extensions/amplify-helpers/get-frontend-plugins';
import { getProviderPlugins } from '../extensions/amplify-helpers/get-provider-plugins';
import { insertAmplifyIgnore } from '../extensions/amplify-helpers/git-manager';
import { writeReadMeFile } from '../extensions/amplify-helpers/docs-manager';
import { initializeEnv } from '../initialize-env';
import _ from 'lodash';

/**
*
*/
export async function onHeadlessSuccess(context: $TSContext) {
const frontendPlugins = getFrontendPlugins(context);
const frontendModule = require(frontendPlugins[context.exeInfo.projectConfig.frontend]);
await frontendModule.onInitSuccessful(context);
}

/**
*
*/
export async function onSuccess(context: $TSContext) {
const { projectPath } = context.exeInfo.localEnvInfo;

Expand Down Expand Up @@ -75,6 +84,15 @@ export async function onSuccess(context: $TSContext) {
if (!context.parameters.options.app) {
printWelcomeMessage(context);
}

const appId = currentAmplifyMeta?.providers?.awscloudformation?.AmplifyAppId;

if (!appId) {
printer.warn('The maximum number of apps that you can create with Amplify in this region has likely been reached:');
printer.info('For more information on Amplify Service Quotas, see:');
printer.info('https://docs.aws.amazon.com/general/latest/gr/amplify.html#service-quotas-amplify');
printer.blankLine();
}
}

function generateLocalRuntimeFiles(context: $TSContext) {
Expand All @@ -83,6 +101,9 @@ function generateLocalRuntimeFiles(context: $TSContext) {
generateLocalTagsFile(context);
}

/**
*
*/
export function generateLocalEnvInfoFile(context: $TSContext) {
const { projectPath } = context.exeInfo.localEnvInfo;

Expand Down Expand Up @@ -114,6 +135,9 @@ function generateLocalTagsFile(context: $TSContext) {
}
}

/**
*
*/
export function generateAmplifyMetaFile(context: $TSContext) {
if (context.exeInfo.isNewEnv) {
const { projectPath } = context.exeInfo.localEnvInfo;
Expand Down