Skip to main content
Question

Firestore RevenueCat Purchases Handler extension throws error for anonymous ($RCAnonymousID) users

  • July 6, 2026
  • 2 replies
  • 81 views

Forum|alt.badge.img+6

We're using the firestore-revenuecat-purchases-handler Firebase Extension, and we occasionally (not every time) see an error in Cloud Functions logs when a webhook event fires for a user who hasn't logged in yet (still on their RevenueCat anonymous ID):

Error saving user $RCAnonymousID:xxx: 
Error: There is no user record corresponding to the provided identifier.
at setCustomClaims (/workspace/lib/index.js:75:38)

It looks like the extension tries to call setCustomUserClaims() using the app_user_id from the event, and when that ID happens to still be an RC anonymous ID ($RCAnonymousID:...) rather than a real Firebase UID, admin.auth() can't find a matching user and throws. Since it's intermittent, my guess is this only happens when a webhook event fires before the user has been identified/logged in with their real Firebase UID.

Questions:

  1. Is this expected/known behavior, and safe to ignore since the claim will just be set correctly once the same user's event re-fires with their real Firebase UID after login?
  2. Is there a config option (or planned fix) to have the extension skip claim-setting for anonymous IDs instead of logging an error?
  3. If not, would a PR filtering out $RCAnonymousID: prefixed IDs before calling setCustomClaims be welcome?

Happy to open an issue/PR if this isn't already tracked — just wanted to check here first in case there's existing context.

Thanks!

2 replies

wes_clark
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • July 6, 2026

Hi ​@asakirullah! Thank you for documenting this situation and your questions well. This is currently an expected behavior, because as we mention in the documentation for the Firebase integration, it currently expects for the FirebaseUID to be what the app user ID is set to. We do not currently have an option to have the extension skip the claim setting for anonymous IDs. I am not sure if we would support making a change to do so, but I am happy to raise the suggestion internally. I will update you on our discussion shortly.


Forum|alt.badge.img+6
  • Author
  • Active Member
  • July 11, 2026

Thanks for the clarification. We already call "Purchases.logIn(firebaseUid)" for all users immediately after authentication, and we don't intentionally allow purchases with anonymous RevenueCat users.

 

However, we're still seeing this error for a small subset of users:

 

"There is no user record corresponding to the provided identifier"

 

and the "app_user_id" in the extension logs is an "$RCAnonymousID".

 

Is there a known race condition where a webhook event can be generated before the "logIn()" call has fully propagated, or are there any other scenarios that could cause RevenueCat to send events with an anonymous ID even when "Purchases.logIn()" is always called?