Skip to content

Conversation

@mmermerkaya
Copy link
Contributor

@mmermerkaya mmermerkaya commented May 9, 2018

#482 added VAPID keys, and started storing vapidKey as part of TokenDetails (code here).

Since we were storing a stringified vapidKey at that point, if there was no vapidKey in an older tokenDetails object, this check (comparing a string to undefined) would simply return false, and get a new token.

After #649, we started to store vapidKey as Uint8Array instead of the stringified version. This also changed the check here, which meant that if vapidKey was still undefined, the check would refer to undefined.buffer, which throws a TypeError.

Because of this, if a user updates from a version of the SDK before #482 directly to a version that includes #649 (4.13 or higher), messaging doesn't work. This PR fixes that by checking the existence of tokenDetails.vapidKey.

tokenDetails: TokenDetails
): boolean {
if (
!tokenDetails.vapidKey ||
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we always save the VAPID key? Even if it's the default one?

Copy link
Contributor Author

@mmermerkaya mmermerkaya May 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we do. I updated the PR description to explain the issue.

@mmermerkaya mmermerkaya merged commit e91742d into master May 9, 2018
@mmermerkaya mmermerkaya deleted the mmermerkaya-missing-vapidkey branch May 9, 2018 15:50
@firebase firebase locked and limited conversation to collaborators Oct 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants