firebase-functions: Storage onFinalize trigger not working in Node 10 runtime
Related issues
No related issue
[REQUIRED] Version info
node: 10.15.3
firebase-functions: ^2.3.0
firebase-tools: 6.10.0
firebase-admin: ~7.0.0
[REQUIRED] Test case
Following the official example :
exports.generateThumbnail = functions.storage.object().onFinalize(async (object) => {
console.log(object);
});
[REQUIRED] Steps to reproduce
When setting node runtime in package.json
in functions
directory :
{
...
"engines": {
"node": "10"
}
}
[REQUIRED] Expected behavior
Should output ObjectMetadata
content in function logs, whatever the node runtime is.
[REQUIRED] Actual behavior
Output is ‘undefined’ with node 10 runtime, but is working fine with node 8 runtime (can see the ObjectMetadata
properties outputted)
Were you able to successfully deploy your functions?
firebase deploy
runs successfully, but object
is undefined.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (6 by maintainers)
Thanks for the the quick response and helping me rule out the other possible issues. I think I know what’s happening here. As a quick sanity check, would you mind setting another env var in your function and see whether that fixes the object being undefined? In the global scope of your function:
Followed by a redeploy. Super appreciate your help in tracking down this issue!
How can I get or fetch “User Id” and “File Name” from the following response-
| generateThumbs | object { “bucket”:“<my_project_id>.appspot.com”, “contentDisposition”:“inline; filename*=utf-8’'image.jpg”, “contentType”:“image/jpeg”, “crc32c”:“WCmI3w==”, “etag”:“CMPmz8GkzuICEAE=”, “generation”:“1559598325822275”, “id”:“<my_project_id>.appspot.com/users/xb1PUonyilfyq3MQMkKh1V2PmHY2/cover/image.jpg/1559598325822275”, “kind”:“storage#object”, “md5Hash”:“lzoTbb/SNAH6XahgYMkuQg==”, “mediaLink”:“https://www.googleapis.com/download/storage/v1/b/<my_project_id>.appspot.com/o/users%2Fxb1PUonyilfyq3MQMkKh1V2PmHY2%2Fcover%2Fimage.jpg?generation=1559598325822275&alt=media”, “metadata”:{ “firebaseStorageDownloadTokens”:“<token>” }, “metageneration”:“1”, “name”:“users/xb1PUonyilfyq3MQMkKh1V2PmHY2/cover/image.jpg”, “selfLink”:“https://www.googleapis.com/storage/v1/b/<my_project_id>.appspot.com/o/users%2Fxb1PUonyilfyq3MQMkKh1V2PmHY2%2Fcover%2Fimage.jpg”, “size”:“163562”, “storageClass”:“STANDARD”, “timeCreated”:“2019-06-03T21:45:25.821Z”, “timeStorageClassUpdated”:“2019-06-03T21:45:25.821Z”, “updated”:“2019-06-03T21:45:25.821Z” }
Thanks!