Closed
Description
Related issues
arguably, this is a bug with moment.js - but i'm not certain who should fix :
moment/moment#5011
[REQUIRED] Version info
node: 12 and 14
firebase-functions: 3.14.1
firebase-tools: 9.14.0
firebase-admin: 9.9.0
moment: 2.29.1
[REQUIRED] Test case
const functions = require('firebase-functions').logger;
const moment = require('moment');
console.log('this works', { m : moment() } );
console.log('this works too!', JSON.stringify({ m: moment() } ));
logger.info('wat! this blows up!', { m : moment() } );
logger.info('but this works!', moment());
[REQUIRED] Steps to reproduce
simply run the test case
[REQUIRED] Expected behavior
logger should allow logging of moment object.
[REQUIRED] Actual behavior
note: this happens locally as well as when deployed
TypeError: config._d.getTime is not a function
at new Moment (/workspace/node_modules/moment/moment.js:258:58)
at Object.clone (/workspace/node_modules/moment/moment.js:3756:16)
at Object.toISOString (/workspace/node_modules/moment/moment.js:3916:28)
at Object.toJSON (/workspace/node_modules/moment/moment.js:4247:38)
at JSON.stringify (<anonymous>)
at write (/workspace/node_modules/firebase-functions/lib/logger.js:39:84)
at Object.info (/workspace/node_modules/firebase-functions/lib/logger.js:81:5)
Were you able to successfully deploy your functions?
yes