firebase / firebase/firebase-js-sdk

Calling a firebase function after registering web client for push via fid unregisters fid as push target

Open
#10,135 6 comments 2 reactions 0 assignees View on GitHub
api: functions api: messaging needs-attention question Repro Needed
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### Operating System

all

### Environment (if applicable)

all browsers

### Firebase SDK Version

12.15.0

### Firebase SDK Product(s)

Functions, Messaging

### Project Tooling

angular, nx, firebase

### Detailed Problem Description

Migrating to the fid based messaging I noticed that push to my clients suddenly stopped working, and sending push messages to the fid reported `messaging/installation-id-not-registered`. I tracked when it happened, and it seems that calling a firebase function via httpsCallable generated an old style push token when appending http headers, and this push token was then registered, invalidating the fid as a push target.

### Steps and code to reproduce issue

1. setup web client push using fid via register method on app startup
2. after above setup, call a firebase function in the project via httpsCallable
3. observe via devtools (Network tab) that a new call to https://fcmregistrations.googleapis.com happens registering a classic deprecated token

the call in the sdk is initied here: https://github.com/firebase/firebase-js-sdk/blob/main/packages/functions/src/context.ts#L151, and you can see it ends up calling the `messaging.getToken()` method to append a `Firebase-Instance-ID-Token` header

Contributor guide

Open the contributing guide

Research direction

Start at packages/functions/src/context.ts around line 151 and trace the httpsCallable header setup into messaging.getToken(). Reproduce the flow with a web client registered by FID, then inspect the Network tab for calls to fcmregistrations.googleapis.com; done means calling the Firebase function no longer registers a deprecated token or invalidates the FID push target.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.