diff --git a/packages/amplify-category-function/src/events/prePushHandler.ts b/packages/amplify-category-function/src/events/prePushHandler.ts index 2bf9b7a5238..fd055352434 100644 --- a/packages/amplify-category-function/src/events/prePushHandler.ts +++ b/packages/amplify-category-function/src/events/prePushHandler.ts @@ -35,7 +35,9 @@ export const prePushHandler = async (context: $TSContext): Promise => { }; const ensureFunctionSecrets = async (context: $TSContext): Promise => { - const backendConfig = stateManager.getBackendConfig(); + const backendConfig = stateManager.getBackendConfig(undefined, { + throwIfNotExist: false, + }); const functionNames = Object.keys(backendConfig?.[categoryName] || {}); for (const funcName of functionNames) { if (getLocalFunctionSecretNames(funcName).length > 0) { diff --git a/packages/amplify-category-function/src/provider-utils/awscloudformation/utils/ensure-lambda-arn-outputs.ts b/packages/amplify-category-function/src/provider-utils/awscloudformation/utils/ensure-lambda-arn-outputs.ts index 0938ff6b68d..c5e45dd9a67 100644 --- a/packages/amplify-category-function/src/provider-utils/awscloudformation/utils/ensure-lambda-arn-outputs.ts +++ b/packages/amplify-category-function/src/provider-utils/awscloudformation/utils/ensure-lambda-arn-outputs.ts @@ -12,7 +12,9 @@ import * as path from 'path'; * updates function cfn stack with lambda execution role arn parameter */ export const ensureLambdaExecutionRoleOutputs = async (): Promise => { - const backendConfig = stateManager.getBackendConfig(); + const backendConfig = stateManager.getBackendConfig(undefined, { + throwIfNotExist: false, + }); const functionNames = Object.keys(backendConfig?.[AmplifyCategories.FUNCTION] ?? []); // filter lambda layer from lambdas in function const lambdaFunctionNames = functionNames.filter((functionName) => {