I have a Google Apps Script that is shared with another user (I own both users - one is my personal Gmail and one is my work account on Gsuite). The script scans threads in my inbox, and applies labels to the threads based on rules.
I set up time-based triggers from each user account to run the script.
The script calls Session.getActiveUser().getEmail() to identify which user is running it, and sets some parameters differently depending on the user.
Logging shows that, for either user, the script errors about half the time, intermittently, saying "The script does not have permission to get the active user's identity." (Clearly it DOES have permission, for each user, or else it would fail every time.)
To troubleshoot this, I stopped sharing the script between users. I made separate copies of the same code, in each user's account. Now the script is running fine for both users.
Can anyone confirm that this is a bug in Google's operating environment? That (I suspect) somehow the operating environment gets confused about which user is running the shared script?
(I did search this forum and can't find a description that explains it)