AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Supabase Firebase Auth Third-Party Guide Code Example Uses Nonexistent `.Id` Instead Of `.Uid`

The Supabase documentation example for assigning role custom claims with Firebase Admin SDK incorrectly references `userRecord.id`, which does not exist on Firebase UserRecord objects. The correct property is `userRecord.uid`. Following the example as written causes a runtime error when calling `setCustomUserClaims` with `undefined` as the user identifier.

mediumConfidence 95%Firebase Admin Node.js

Origin Analysis

The documentation snippet uses `userRecord.id`, but the Firebase Admin Node.js SDK's UserRecord interface defines `uid` as the unique user identifier property. This is a typo/misreference in the Supabase documentation.
1. Open the Supabase docs page: https://supabase.com/docs/guides/auth/third-party/firebase-auth#use-the-admin-sdk-to-assign-the-role-custom-claim-to-all-users 2. Copy the provided Firebase Admin code snippet. 3. Run the script with a valid Firebase service account. 4. Observe that `userRecord.id` is `undefined`, causing `setCustomUserClaims(undefined, { role: 'supabase_access' })` to throw an error like `TypeError: uid must be a non-empty string`.

Fixing Code Block

const admin = require('firebase-admin'); admin.initializeApp(); admin.auth().listUsers().then((listUsersResult) => { listUsersResult.users.forEach((userRecord) => { admin.auth().setCustomUserClaims(userRecord.uid, { role: 'supabase_access' }); }); });
Replace the erroneous `.id` property access with `.uid`, which is the correct field on Firebase UserRecord objects as defined in the firebase-admin-node SDK.

Edge Case Audit

Documentation-only change; no deployment risk. However, if users copy the updated snippet, note that `listUsers` is paginated and the example only processes the first page by default. For production use, iterate through all pages or use `listUsers(1000)` with pagination. Rollback: simply revert the documentation change if it conflicts with other examples.

Ecosystem Topology