From f951936406ba680ab08a56f100cb16776314a1a9 Mon Sep 17 00:00:00 2001 From: Kevin Pagtakhan Date: Mon, 25 Nov 2024 12:04:20 -0800 Subject: [PATCH] fix: missing body for fetch intercepts in ga events forwarder --- packages/plugin-autocapture-browser/package.json | 2 +- packages/plugin-ga-events-forwarder-browser/package.json | 2 +- .../src/ga-events-forwarder.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/plugin-autocapture-browser/package.json b/packages/plugin-autocapture-browser/package.json index bc10dad51..19905b151 100644 --- a/packages/plugin-autocapture-browser/package.json +++ b/packages/plugin-autocapture-browser/package.json @@ -32,7 +32,7 @@ "publish": "node ../../scripts/publish/upload-to-s3.js", "test": "jest", "typecheck": "tsc -p ./tsconfig.json", - "version": "yarn version-file && yarn add @amplitude/analytics-client-common@\">=1 <3\"", + "version": "yarn version-file && yarn add @amplitude/analytics-client-common@\">=1 <3\" && yarn build", "version-file": "node -p \"'export const VERSION = \\'' + require('./package.json').version + '\\';'\" > src/version.ts" }, "bugs": { diff --git a/packages/plugin-ga-events-forwarder-browser/package.json b/packages/plugin-ga-events-forwarder-browser/package.json index 81f114272..70a48e616 100644 --- a/packages/plugin-ga-events-forwarder-browser/package.json +++ b/packages/plugin-ga-events-forwarder-browser/package.json @@ -32,7 +32,7 @@ "publish": "node ../../scripts/publish/upload-to-s3.js", "test": "jest", "typecheck": "tsc -p ./tsconfig.json", - "version": "yarn version-file && yarn add @amplitude/analytics-types@\">=1 <3\" @amplitude/analytics-client-common@\">=1 <3\"", + "version": "yarn version-file && yarn add @amplitude/analytics-types@\">=1 <3\" @amplitude/analytics-client-common@\">=1 <3\" && yarn build", "version-file": "node -p \"'export const VERSION = \\'' + require('./package.json').version + '\\';'\" > src/version.ts" }, "bugs": { diff --git a/packages/plugin-ga-events-forwarder-browser/src/ga-events-forwarder.ts b/packages/plugin-ga-events-forwarder-browser/src/ga-events-forwarder.ts index 9b255fc1c..e23c8026e 100644 --- a/packages/plugin-ga-events-forwarder-browser/src/ga-events-forwarder.ts +++ b/packages/plugin-ga-events-forwarder-browser/src/ga-events-forwarder.ts @@ -102,7 +102,7 @@ export const gaEventsForwarderPlugin = ({ measurementIds = [] }: Options = {}): return intercept(requestUrl, data); }; - const interceptFetch: FetchInterceptor = (resource, _options) => { + const interceptFetch: FetchInterceptor = (resource, options) => { let requestUrl: string | URL = ''; // Fetch accepts strings, objects with stringifiers, or request objects @@ -120,7 +120,7 @@ export const gaEventsForwarderPlugin = ({ measurementIds = [] }: Options = {}): logger?.error(e); } - intercept(requestUrl, null); + intercept(requestUrl, options?.body); }; /**