Skip to content

Functions v2 missing labels with Firebase structured logs #1331

Closed
@metadiego

Description

@metadiego

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:
Screen Shot 2022-12-27 at 10 04 32 AM

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:
Screen Shot 2022-12-27 at 9 49 40 AM

[REQUIRED] Actual behavior

v2 function does not include any labels.

Were you able to successfully deploy your functions?

Yes.

No

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions