Custom logging from firebase function
Solution 1:
OK, I finally tracked it down. According to this answer, the service account used by firebase functions is {project-id}@appspot.gserviceaccount.com
, and in my project, that account did not have the 'Logs Writer' role. Adding that role solves the problem.
I find it odd that the firebase functions don't need that role to log messages using console.log()
, but perhaps that call is intercepted by the functions environment, and the logs are written as a different service account. It also explains why the functions running locally were able to write the logs, as they run using the 'owner' service account, which has full access.