Skip to content

Commit c125777

Browse files
committed
fix: wrap in try/catch
1 parent dedf0c5 commit c125777

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/amplify-category-auth/src/events/prePushHandler.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@ import { AuthInputState } from '../provider-utils/awscloudformation/auth-inputs-
33
import { getAuthResourceName } from '../utils/getAuthResourceName';
44

55
export const prePushHandler = async (context: $TSContext): Promise<void> => {
6-
const inputState = new AuthInputState(context, await getAuthResourceName(context));
6+
let authResourceName: string;
7+
try {
8+
authResourceName = await getAuthResourceName(context);
9+
} catch {
10+
// if the project doesn't have auth, early return
11+
return;
12+
}
13+
14+
const inputState = new AuthInputState(context, authResourceName);
715
if (!inputState.cliInputFileExists()) {
816
throw new AmplifyError('InvalidMigrationError', {
917
message: 'Auth configuration needs to be migrated before pushing.',

0 commit comments

Comments
 (0)