diff --git a/package.json b/package.json index 775638b2e4d..6e9cce31ed7 100644 --- a/package.json +++ b/package.json @@ -158,7 +158,7 @@ "@yarn/plugin-typescript" ] }, - "packageManager": "yarn@3.5.0", + "packageManager": "yarn@3.6.3", "resolutions": { "aws-sdk": "^2.1464.0", "cross-fetch": "^2.2.6", diff --git a/packages/amplify-category-function/src/provider-utils/awscloudformation/secrets/functionSecretsStateManager.ts b/packages/amplify-category-function/src/provider-utils/awscloudformation/secrets/functionSecretsStateManager.ts index eedab135367..6f3f2db2860 100644 --- a/packages/amplify-category-function/src/provider-utils/awscloudformation/secrets/functionSecretsStateManager.ts +++ b/packages/amplify-category-function/src/provider-utils/awscloudformation/secrets/functionSecretsStateManager.ts @@ -100,7 +100,11 @@ export class FunctionSecretsStateManager { return; } const cloudSecretNames = await this.getCloudFunctionSecretNames(functionName); - const addedSecrets = localSecretNames.filter((name) => !cloudSecretNames.includes(name)); + const retainedSecrets: string[] = []; + const addedSecrets: string[] = []; + + localSecretNames.forEach((name) => (cloudSecretNames.includes(name) ? retainedSecrets.push(name) : addedSecrets.push(name))); + if (!addedSecrets.length) { return; } @@ -118,8 +122,12 @@ export class FunctionSecretsStateManager { link: 'https://docs.amplify.aws/cli/reference/ssm-parameter-store/#manually-creating-parameters', }); } + + const current = secretNamesToSecretDeltas(retainedSecrets); const delta = await prePushMissingSecretsWalkthrough(functionName, addedSecrets); - await this.syncSecretDeltas(delta, functionName); + const secretDeltas = { ...current, ...delta }; + + await this.syncSecretDeltas(secretDeltas, functionName); }; /**