diff --git a/packages/analytics-core/src/plugins/destination.ts b/packages/analytics-core/src/plugins/destination.ts index 0710ba7c7..ab4be3a25 100644 --- a/packages/analytics-core/src/plugins/destination.ts +++ b/packages/analytics-core/src/plugins/destination.ts @@ -135,6 +135,7 @@ export class Destination implements DestinationPlugin { async send(list: Context[], useRetry = true) { if (!this.config.apiKey) { + (this.config.diagnosticProvider as Diagnostic).track(list.length, 400, 'missing API key'); return this.fulfillRequest(list, 400, MISSING_API_KEY_MESSAGE); } @@ -154,6 +155,7 @@ export class Destination implements DestinationPlugin { const { serverUrl } = createServerConfig(this.config.serverUrl, this.config.serverZone, this.config.useBatch); const res = await this.config.transportProvider.send(serverUrl, payload); if (res === null) { + (this.config.diagnosticProvider as Diagnostic).track(list.length, 0, 'unexpected error'); this.fulfillRequest(list, 0, UNEXPECTED_ERROR_MESSAGE); (this.config.diagnosticProvider as Diagnostic).track(list.length, 0, 'unexpected error'); return;