Skip to content

functions.logger.log crashes function if passed certain objects #737

Closed
@nikmartin

Description

@nikmartin

[REQUIRED] Version info

node: 10

firebase-functions: 3.7.0

firebase-tools: 8.4.3

firebase-admin: 8.12.1

[REQUIRED] Test case

const functions = require('firebase-functions');
exports.loggerTest = functions.https.onCall((data, context) => {
    functions.logger.log('context:', context);
});

[REQUIRED] Steps to reproduce

I have two scenarios that will reliably crash a firebase function using the logger:

  • log context in a callable
  • log the entire request in an https function

[REQUIRED] Expected behavior

[REQUIRED] Actual behavior

1:18:40.769 PM execution took 3196 ms, finished with status code: 500 |  
  at func (/workspace/node_modules/firebase-functions/lib/providers/https.js:272:32) 
  at process._tickCallback (internal/process/next_tick.js:68:7) 
  at exports.assignCard.functions.https.onCall (/workspace/index.js:3591:20) 
  at Object.log (/workspace/node_modules/firebase-functions/lib/logger.js:45:5)
  at write (/workspace/node_modules/firebase-functions/lib/logger.js:12:84) 
  at JSON.stringify (<anonymous>) 
  Unhandled error TypeError: Converting circular structure to JSON

Were you able to successfully deploy your functions?

Yes

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions