firebase-functions icon indicating copy to clipboard operation
firebase-functions copied to clipboard

TypeError log will be split into multiple lines

Open ishowta opened this issue 3 years ago • 0 comments

Related issues

[REQUIRED] Version info

node: 16

firebase-functions: 3.22.0

firebase-tools: 10.6.0

firebase-admin: 10.0.2

[REQUIRED] Test case

If a TypeError occurs, the Cloud Logging log will have multiple lines.

// index.js

const functions = require('firebase-functions')

exports.test = functions.https.onRequest(() => {
  'hello'()  // TypeError: "hello" is not a function
})

Therefore, if the file path is long, the stack trace will be a completely separate line and will not be treated as an Error.

// index.js

exports.test =
    require('./test-longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong').test

// test-longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong.js

const functions = require('firebase-functions')

exports.test = functions.https.onRequest(() => {
  'hello'()  // TypeError: "hello" is not a function
})

2022-08-31_142701

[REQUIRED] Steps to reproduce

run function

[REQUIRED] Expected behavior

The errors are combined into a single log and sent to Error Reporting, just like normal errors.

[REQUIRED] Actual behavior

Split into multiple logs and not sent to Error Reporting

Were you able to successfully deploy your functions?

yes

ishowta avatar Aug 31 '22 05:08 ishowta