From 38c3658482c8f02368f969e3de82cbb489659994 Mon Sep 17 00:00:00 2001 From: Kai Wu Date: Wed, 25 Sep 2024 12:50:41 -0700 Subject: [PATCH 1/3] Update endpoint to Clearlog --- packages/messaging/src/helpers/logToFirelog.test.ts | 7 ++----- packages/messaging/src/helpers/logToFirelog.ts | 11 +++++------ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/messaging/src/helpers/logToFirelog.test.ts b/packages/messaging/src/helpers/logToFirelog.test.ts index 04e201bfc3a..eee5fac6778 100644 --- a/packages/messaging/src/helpers/logToFirelog.test.ts +++ b/packages/messaging/src/helpers/logToFirelog.test.ts @@ -31,10 +31,7 @@ import { MessagingService } from '../messaging-service'; import { Stub } from '../testing/sinon-types'; import { getFakeMessagingService } from '../testing/fakes/messaging-service'; -const FIRELOG_ENDPOINT = LogModule._mergeStrings( - 'hts/frbslgigp.ogepscmv/ieo/eaylg', - 'tp:/ieaeogn-agolai.o/1frlglgc/o' -); +const LOG_ENDPOINT = "https://play.google.com/log?format=json_proto3"; const FCM_TRANSPORT_KEY = LogModule._mergeStrings( 'AzSCbw63g1R0nCw85jG8', @@ -68,7 +65,7 @@ describe('logToFirelog', () => { // assert expect(fetchStub).to.be.calledOnceWith( - FIRELOG_ENDPOINT.concat('?key=', FCM_TRANSPORT_KEY), + LOG_ENDPOINT.concat('&key=', FCM_TRANSPORT_KEY), { method: 'POST', body: JSON.stringify(LogModule._createLogRequest([getFakeLogEvent()])) diff --git a/packages/messaging/src/helpers/logToFirelog.ts b/packages/messaging/src/helpers/logToFirelog.ts index 86b334ca91b..010ac09c00f 100644 --- a/packages/messaging/src/helpers/logToFirelog.ts +++ b/packages/messaging/src/helpers/logToFirelog.ts @@ -36,10 +36,7 @@ import { import { MessagePayloadInternal } from '../interfaces/internal-message-payload'; import { MessagingService } from '../messaging-service'; -const FIRELOG_ENDPOINT = _mergeStrings( - 'hts/frbslgigp.ogepscmv/ieo/eaylg', - 'tp:/ieaeogn-agolai.o/1frlglgc/o' -); +const LOG_ENDPOINT = "https://play.google.com/log?format=json_proto3"; const FCM_TRANSPORT_KEY = _mergeStrings( 'AzSCbw63g1R0nCw85jG8', @@ -97,7 +94,7 @@ export async function _dispatchLogEvents( do { try { response = await fetch( - FIRELOG_ENDPOINT.concat('?key=', FCM_TRANSPORT_KEY), + LOG_ENDPOINT.concat('&key=', FCM_TRANSPORT_KEY), { method: 'POST', body: JSON.stringify(logRequest) @@ -216,7 +213,9 @@ function createAndEnqueueLogEvent( /* eslint-disable camelcase */ logEvent.event_time_ms = Math.floor(Date.now()).toString(); - logEvent.source_extension_json_proto3 = JSON.stringify(fcmEvent); + logEvent.source_extension_json_proto3 = JSON.stringify({ + messaging_client_event: fcmEvent + }); if (!!productId) { logEvent.compliance_data = buildComplianceData(productId); From 843657ad03b4ae6b6c2b8cb7ec3c80c05b704af7 Mon Sep 17 00:00:00 2001 From: Kai Wu Date: Wed, 25 Sep 2024 13:03:26 -0700 Subject: [PATCH 2/3] Create four-pillows-fetch.md --- .changeset/four-pillows-fetch.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/four-pillows-fetch.md diff --git a/.changeset/four-pillows-fetch.md b/.changeset/four-pillows-fetch.md new file mode 100644 index 00000000000..11e65a57574 --- /dev/null +++ b/.changeset/four-pillows-fetch.md @@ -0,0 +1,5 @@ +--- +'@firebase/messaging': patch +--- + +The logging endpoint has been updated to ensure proper logging of WebPush entries. This resolves an issue where BigQuery logs were missing WebPush data. The payload structure has also been updated in alignment with the latest logging requirements as specified in go/firelog. From aaa1a54cb2dc5922bba67e1909166f5f3ab322a4 Mon Sep 17 00:00:00 2001 From: Kai Wu Date: Wed, 25 Sep 2024 13:19:50 -0700 Subject: [PATCH 3/3] Ran yarn format --- packages/messaging/src/helpers/logToFirelog.test.ts | 2 +- packages/messaging/src/helpers/logToFirelog.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/messaging/src/helpers/logToFirelog.test.ts b/packages/messaging/src/helpers/logToFirelog.test.ts index eee5fac6778..fcc3402dd19 100644 --- a/packages/messaging/src/helpers/logToFirelog.test.ts +++ b/packages/messaging/src/helpers/logToFirelog.test.ts @@ -31,7 +31,7 @@ import { MessagingService } from '../messaging-service'; import { Stub } from '../testing/sinon-types'; import { getFakeMessagingService } from '../testing/fakes/messaging-service'; -const LOG_ENDPOINT = "https://play.google.com/log?format=json_proto3"; +const LOG_ENDPOINT = 'https://play.google.com/log?format=json_proto3'; const FCM_TRANSPORT_KEY = LogModule._mergeStrings( 'AzSCbw63g1R0nCw85jG8', diff --git a/packages/messaging/src/helpers/logToFirelog.ts b/packages/messaging/src/helpers/logToFirelog.ts index 010ac09c00f..0e9ab096d87 100644 --- a/packages/messaging/src/helpers/logToFirelog.ts +++ b/packages/messaging/src/helpers/logToFirelog.ts @@ -36,7 +36,7 @@ import { import { MessagePayloadInternal } from '../interfaces/internal-message-payload'; import { MessagingService } from '../messaging-service'; -const LOG_ENDPOINT = "https://play.google.com/log?format=json_proto3"; +const LOG_ENDPOINT = 'https://play.google.com/log?format=json_proto3'; const FCM_TRANSPORT_KEY = _mergeStrings( 'AzSCbw63g1R0nCw85jG8', @@ -214,7 +214,7 @@ function createAndEnqueueLogEvent( /* eslint-disable camelcase */ logEvent.event_time_ms = Math.floor(Date.now()).toString(); logEvent.source_extension_json_proto3 = JSON.stringify({ - messaging_client_event: fcmEvent + messaging_client_event: fcmEvent }); if (!!productId) {