Skip to content

docs: align docs with actual auth/authType behaviour#1913

Open
IzaakGough wants to merge 1 commit into
masterfrom
@invertase/docs-change-auth
Open

docs: align docs with actual auth/authType behaviour#1913
IzaakGough wants to merge 1 commit into
masterfrom
@invertase/docs-change-auth

Conversation

@IzaakGough

@IzaakGough IzaakGough commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Correct the v1 EventContext TSDoc so it documents auth and authType as Realtime Database-specific behavior.
  • Clarify that callable auth uses https.CallableContext.auth, and that non-RTDB events leave authType unset rather than null.

Problem/Root Cause

The existing EventContext comments described auth as applying to both Realtime Database triggers and callable functions, and described authType as null for non-RTDB events. That does not match the actual v1 runtime behavior: the SDK only populates EventContext.auth and EventContext.authType for Realtime Database triggers, while callable functions expose auth on https.CallableContext instead. For non-RTDB EventContext events, authType is not set.

Solution/Changes

Update the EventContext TSDoc to describe the real behavior implemented by the v1 SDK:

  • mark EventContext.auth as Realtime Database-only
  • document unauthenticated Realtime Database events as auth: null
  • document callable auth on https.CallableContext.auth instead of EventContext.auth
  • describe authType as Realtime Database-only and not set for non-RTDB events

Testing

  • Manually verified with the Emulator Suite:
  • Realtime Database v1 trigger logged authType: "ADMIN" with auth: undefined for an admin write.
  • Firestore v1 trigger logged auth: undefined and authType: undefined.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the JSDoc documentation for the auth and authType properties of the EventContext interface in src/v1/cloud-functions.ts. It clarifies that these fields are only populated for Realtime Database triggers, explains their behavior for unauthenticated users, and directs users to https.CallableContext.auth for Callable functions. I have no feedback to provide.

@IzaakGough IzaakGough marked this pull request as ready for review June 18, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants