FormApp isn't behaving as expected. Trying to open a form either by URL or ID like this:
var form = FormApp.openById(id);
The code execution results in this (quiet) error in the logs:
Exception: You do not have permission to call FormApp.openByUrl.
Required permissions: https://www.googleapis.com/auth/forms
But File-->Project Properties-->Scopes shows
3 OAuth Scopes required by the script:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/forms
https://www.googleapis.com/auth/spreadsheets
I even tried setting the oauthscopes manually as suggested elsewhere without any success.
So now I'm confused ... what am I missing here?
Addendum:
If I run the function manually from the Google Scripts editor, the function executes as expected.
The function throws the above error only when it is called by the Spreadsheet.