-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
After deploying using firebase-tools 12.6.1, our functions are crashing at runtime with the following stacktrace:
Error: TypeError: Cannot read properties of undefined (reading 'headers')
at /layers/google.nodejs.yarn/yarn_modules/node_modules/firebase-functions/lib/v2/trace.js:12:68
at /layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/function_wrappers.js:141:25
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at console.error (/layers/google.nodejs.yarn/yarn_modules/node_modules/firebase-functions/lib/logger/compat.js:31:23)
at sendCrashResponse (/layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/logger.js:27:17)
at sendResponse (/layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/invoker.js:37:40)
at /layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/function_wrappers.js:34:40
at bound (node:domain:433:15)
at runBound (node:domain:444:12)
at /layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/function_wrappers.js:142:60
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
We're also crashing in our own code when trying to read request.rawBody.toString() as rawBody is undefined. It looks like something is wrong with the request objects being passed to the http functions.
We saw a very similar issue in 12.5.0 (#6290)
It looks like with this PR #6376 the issue might have been reintroduced.
@blidd-google can you take a look at this please?
[REQUIRED] Environment info
firebase-functions v2
Node 18.12.1
firebase-tools:
12.6.1
Platform:
[REQUIRED] Test case
Deploy a V2 http function with 12.6.1
Redeploy with 12.4.8 and functions work correctly
[REQUIRED] Steps to reproduce
Deploy a V2 http function with 12.6.1
[REQUIRED] Expected behaviour
It should not crash, correct properties should be defined on the request/response object
[REQUIRED] Actual behaviour
Crash, request object properties are undefined