I have an old code for Google Cloud Functions, it resized an image to create a thumbnail, I wrote it three years ago and was in NodeJS 6, it was working fine but i had to update to NodeJS 10, i added
"engines": {
"node": "10"
}
other functions continued working but this not
exports.generateThumbnail = functions.storage.object().onFinalize(async (object) => {
const contentType = object.contentType;
it throws an error when i try to access "object" apparently is undefined, the log error is
TypeError: Cannot read property 'contentType' of undefined
at exports.generateThumbnail.functions.storage.object.onFinalize (/workspace/index.js:30:32)
at cloudFunctionNewSignature (/workspace/node_modules/firebase-functions/lib/cloud-functions.js:120:23)
at cloudFunction (/workspace/node_modules/firebase-functions/lib/cloud-functions.js:151:20)
at Promise.resolve.then (/layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/invoker.js:199:28)
at process._tickCallback (internal/process/next_tick.js:68:7)
I updated firebase-admin, firebase-functions, google-cloud-storage, but it did not solve my problem What could have happened and how do I solve it?