Description
Firebase logger structured logs for v2 Cloud functions are missing labels.
This causes a secondary issue, which is that, when trying to access function logs from Firebase console, the logs are empty. Reason being that the URL generated when you click 'View Logs' (see screenshot below) assumes that the function has appropriate labels, but it does not:
Related issues
Maybe this: #703
[REQUIRED] Version info
**node:**16
**firebase-functions:**3.24.1
**firebase-tools:**11.19.0
**firebase-admin:**11.3.0
[REQUIRED] Test case
Create a log from a v2 Cloud Function. Invoke the function. Go to Firebase console > Functions. Click on 'View logs' for previously created function. Logs will be empty because labels are missing.
[REQUIRED] Steps to reproduce
Create a v2 Cloud Function and, using logger, create a structured log, for example:
functions.logger.debug('Hello world', { structuredData: true });
Inspect the output in your logs.
[REQUIRED] Expected behavior
v2 function logs are similar to v1 function logs, which include labels: function name and version, like this example v1 log label:
[REQUIRED] Actual behavior
v2 function does not include any labels.
Were you able to successfully deploy your functions?
Yes.
No