clasp
clasp copied to clipboard
Bug Report: SpreadsheetApp Functionality Failure in clasp 3.0.3-alpha
Bug: SpreadsheetApp.getActiveSpreadsheet Fails in clasp 3.0.3-alpha
Summary
The SpreadsheetApp.getActiveSpreadsheet function, executed via clasp run, works correctly in clasp 2.4.3 but fails with a permission error in clasp 3.0.3-alpha.
Environment
- clasp Version: 3.0.3-alpha
- Function:
SpreadsheetApp.getActiveSpreadsheet - Error Message:
Exception: Error: You do not have permission to call SpreadsheetApp.getActiveSpreadsheet. Required permissions: (https://www.googleapis.com/auth/spreadsheets.currentonly || https://www.googleapis.com/auth/spreadsheets) []
Steps to Reproduce
- Install clasp 3.0.3-alpha globally.
- Run a script that calls
SpreadsheetApp.getActiveSpreadsheetusingclasp run. - Observe the permission error mentioned above.
Expected Behavior
- The script should execute successfully, as it does in clasp 2.4.3.
Actual Behavior
- The script fails with the permission error in clasp 3.0.3-alpha.
Comparative Behavior
- clasp 2.4.3: The same script runs without errors using
clasp run. - clasp 3.0.3-alpha: Fails due to the permission error.
Workaround
- Downgrade clasp to version 2.4.3 globally:
npm install -g @google/[email protected] - The script then runs successfully.
Additional Notes
- This issue likely results from changes in permission handling for
SpreadsheetAppin clasp 3.0.3-alpha. - If unintentional, this represents a regression from previous functionality.
- The permission scopes acquired by clasp (
https://www.googleapis.com/auth/spreadsheets.currentonlyorhttps://www.googleapis.com/auth/spreadsheets) need to be properly handled to ensure functionality.
Request
- Investigate the cause of the permission error.
- Restore
SpreadsheetApp.getActiveSpreadsheetfunctionality in clasp 3.0.3-alpha.
Related Issues
- [Add references to any related issues, if known]
Please include the command line that you used.
Likely this is due to changes in auth handling to use named user accounts by default instead of separate global/local files. 3.x doesn't attempt to load the previously authorized local credentials for run.
Adding the option --auth <path_to_clasprc.json> should work. Give that a try, and if so, I'll update the migration instructions
Closing due to lack of follow up