diff --git a/src/dispatch/Dispatch.ts b/src/dispatch/Dispatch.ts index 7fbcc1ce..0b8cc5ea 100644 --- a/src/dispatch/Dispatch.ts +++ b/src/dispatch/Dispatch.ts @@ -38,7 +38,7 @@ export class Dispatch { private dispatchTimerId: number | undefined; private buildClient: ClientBuilder; private config: Config; - private disableCodes = ['401', '403', '404']; + private disableCodes = ['403', '404']; constructor( region: string, diff --git a/src/dispatch/__tests__/Dispatch.test.ts b/src/dispatch/__tests__/Dispatch.test.ts index 9433d2a9..d1400386 100644 --- a/src/dispatch/__tests__/Dispatch.test.ts +++ b/src/dispatch/__tests__/Dispatch.test.ts @@ -479,36 +479,6 @@ describe('Dispatch tests', () => { expect((dispatch as unknown as any).enabled).toBe(true); }); - test('when a fetch request is rejected with 401 then dispatch is disabled', async () => { - // Init - (DataPlaneClient as any).mockImplementationOnce(() => ({ - sendFetch: () => Promise.reject(new Error('401')) - })); - - const eventCache: EventCache = - Utils.createDefaultEventCacheWithEvents(); - - const dispatch = new Dispatch( - Utils.AWS_RUM_REGION, - Utils.AWS_RUM_ENDPOINT, - eventCache, - { - ...DEFAULT_CONFIG, - ...{ dispatchInterval: Utils.AUTO_DISPATCH_OFF, retries: 0 } - } - ); - dispatch.setAwsCredentials(Utils.createAwsCredentials()); - - // Run - eventCache.recordEvent('com.amazon.rum.event1', {}); - - // Assert - await expect(dispatch.dispatchFetch()).rejects.toEqual( - new Error('401') - ); - expect((dispatch as unknown as any).enabled).toBe(false); - }); - test('when a fetch request is rejected with 403 then dispatch is disabled', async () => { // Init (DataPlaneClient as any).mockImplementationOnce(() => ({