firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.02k stars 937 forks source link

Emulator firestore onDocumentCreatedWithAuthContext not receiving uuid #7609

Closed peterlauri closed 2 months ago

peterlauri commented 2 months ago

[REQUIRED] Environment info

firebase-tools: 13.16.0

Platform: macOS 14.6.1

[REQUIRED] Test case

This firebase index.js function:

"use strict";

// The Cloud Functions for Firebase SDK to create Cloud Functions and triggers.
const { logger } = require("firebase-functions");
const { onRequest } = require("firebase-functions/v2/https");
const { onDocumentCreatedWithAuthContext } = require("firebase-functions/v2/firestore");
const { auth } = require("firebase-functions/v1");

// The Firebase Admin SDK to access Firestore.
const { initializeApp } = require("firebase-admin/app");
const { getFirestore } = require("firebase-admin/firestore");

initializeApp();

exports.testAuthContextEntries = onDocumentCreatedWithAuthContext("/entries/{documentId}", (event) => {
  const { authType, authId } = event;
  logger.log("testAuthContextEntries:", authType, authId);
});

[REQUIRED] Steps to reproduce

[REQUIRED] Expected behavior

>  {"severity":"INFO","message":"testAuthContextEntries: unknown abc123"}

[REQUIRED] Actual behavior

>  {"severity":"INFO","message":"testAuthContextEntries: unknown fake-auth-id@gmail.com"}
aalej commented 2 months ago

Hey @peterlauri, thanks for the detailed report. Looking at the information provided, it seems like the issue you’re encountering is similar to #7450. To better track this, please leave a comment or a thumbs up on the original issue.

That said, I’ll be closing this as a duplicate. If you think this is a mistake, feel free to ask this to be re-opened.