Skip to content

Commit c2762e2

Browse files
author
Manuel Iglesias
committed
Make invalid auth type error non retryable
1 parent 25718f8 commit c2762e2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/aws-appsync/src/link/auth-link.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import * as Url from 'url';
1616

1717
import { userAgent } from "../platform";
1818
import { Credentials, CredentialsOptions } from 'aws-sdk/lib/credentials';
19+
import { PERMANENT_ERROR_KEY } from './retry-link';
1920

2021
const packageInfo = require("../../package.json");
2122

@@ -160,7 +161,10 @@ export const authLink = ({ url, region, auth: { type } = <AuthOptions>{}, auth }
160161
promise = headerBasedAuth({ header: 'Authorization', value: jwtToken }, operation, forward);
161162
break;
162163
default:
163-
throw new Error(`Invalid AUTH_TYPE: ${(<AuthOptions>auth).type}`);
164+
const error = new Error(`Invalid AUTH_TYPE: ${(<AuthOptions>auth).type}`);
165+
error[PERMANENT_ERROR_KEY] = true;
166+
167+
throw error;
164168
}
165169

166170
promise.then(observable => {

0 commit comments

Comments
 (0)