admin管理员组文章数量:1432359
Currently we have a Firebase function responsible to listen for ‘xyz_event’.
When this event is sent from both Android/IOS, after the third submission we are still able to see the events (4th, 5th…) , coming on the analytics debug view. However, the event is not triggering the firebase function. Once the function is triggered it should create a log with the payload It just starts to trigger the function and create the logs again after 5 minutes.
Just thinking if there is a batch loading on Firebase SDK when submit the events or some setting on firebase to aggregate those events to prevent duplication.
event-functions.ts
import * as functions from 'firebase-functions';
import { Constants } from './assets/constants';
import { eventProcessor } from './event-processor';
export const screenView = functions
.runWith({
secrets: [
Constants.FUNCTIONS_SETTINGS.SECRETS.SERVICE.CLIENTKEY,
Constants.FUNCTIONS_SETTINGS.SECRETS.SERVICE.CLIENTSECRET,
],
})
.region(Constants.FUNCTIONS_SETTINGS.REGION.EUROPE)
.analytics.event('footer_click')
.onLog(async (event) => {
await eventProcessor.submitEvent(Constants.TYPE.VIEW, event);
return null;
});
event-processor.ts
import * as functions from 'firebase-functions';
import { AnalyticsEvent } from 'firebase-functions/v1/analytics';
import { buildEventRequestHandler } from './handlers/build-event-request-handler';
import { logging } from './initApp';
const log = logging.log('EventProcessor');
const METADATA = {
resource: {
type: 'cloud_function',
labels: {
function_name: 'submitEvent',
}
}
};
class EventProcessor {
public async submitEvent(eventType: string, eventPayload: AnalyticsEvent) {
const firebaseId = eventPayload?.user?.appInfo?.appInstanceId;
const user = eventPayload?.user;
const logData = {
eventType,
eventPayload
};
log.info(log.entry(METADATA, logData));
This line should create the log and after the third request it's not being logged.
log.info(log.entry(METADATA, logData));
本文标签: javascriptFirebase FunctionsMissing events logging after third requestStack Overflow
版权声明:本文标题:javascript - Firebase Functions - Missing events logging after third request - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745602493a2665647.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论