Skip to content

Commit d6fa588

Browse files
authoredSep 30, 2024··
Update endpoint to Clearlog (#8534)
* Update endpoint to Clearlog * Create four-pillows-fetch.md * Ran yarn format
1 parent d59563a commit d6fa588

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed
 

‎.changeset/four-pillows-fetch.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/messaging': patch
3+
---
4+
5+
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.

‎packages/messaging/src/helpers/logToFirelog.test.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ import { MessagingService } from '../messaging-service';
3131
import { Stub } from '../testing/sinon-types';
3232
import { getFakeMessagingService } from '../testing/fakes/messaging-service';
3333

34-
const FIRELOG_ENDPOINT = LogModule._mergeStrings(
35-
'hts/frbslgigp.ogepscmv/ieo/eaylg',
36-
'tp:/ieaeogn-agolai.o/1frlglgc/o'
37-
);
34+
const LOG_ENDPOINT = 'https://play.google.com/log?format=json_proto3';
3835

3936
const FCM_TRANSPORT_KEY = LogModule._mergeStrings(
4037
'AzSCbw63g1R0nCw85jG8',
@@ -68,7 +65,7 @@ describe('logToFirelog', () => {
6865

6966
// assert
7067
expect(fetchStub).to.be.calledOnceWith(
71-
FIRELOG_ENDPOINT.concat('?key=', FCM_TRANSPORT_KEY),
68+
LOG_ENDPOINT.concat('&key=', FCM_TRANSPORT_KEY),
7269
{
7370
method: 'POST',
7471
body: JSON.stringify(LogModule._createLogRequest([getFakeLogEvent()]))

‎packages/messaging/src/helpers/logToFirelog.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ import {
3636
import { MessagePayloadInternal } from '../interfaces/internal-message-payload';
3737
import { MessagingService } from '../messaging-service';
3838

39-
const FIRELOG_ENDPOINT = _mergeStrings(
40-
'hts/frbslgigp.ogepscmv/ieo/eaylg',
41-
'tp:/ieaeogn-agolai.o/1frlglgc/o'
42-
);
39+
const LOG_ENDPOINT = 'https://play.google.com/log?format=json_proto3';
4340

4441
const FCM_TRANSPORT_KEY = _mergeStrings(
4542
'AzSCbw63g1R0nCw85jG8',
@@ -97,7 +94,7 @@ export async function _dispatchLogEvents(
9794
do {
9895
try {
9996
response = await fetch(
100-
FIRELOG_ENDPOINT.concat('?key=', FCM_TRANSPORT_KEY),
97+
LOG_ENDPOINT.concat('&key=', FCM_TRANSPORT_KEY),
10198
{
10299
method: 'POST',
103100
body: JSON.stringify(logRequest)
@@ -216,7 +213,9 @@ function createAndEnqueueLogEvent(
216213

217214
/* eslint-disable camelcase */
218215
logEvent.event_time_ms = Math.floor(Date.now()).toString();
219-
logEvent.source_extension_json_proto3 = JSON.stringify(fcmEvent);
216+
logEvent.source_extension_json_proto3 = JSON.stringify({
217+
messaging_client_event: fcmEvent
218+
});
220219

221220
if (!!productId) {
222221
logEvent.compliance_data = buildComplianceData(productId);

0 commit comments

Comments
 (0)
Please sign in to comment.