Skip to content

Can't push scripts by service account #1051

@choreo

Description

@choreo

Hi. I connected Apps Script with Google Cloud project and created a service account.

As README says,

To use a service account to push or pull files from Apps Script, the scripts must be shared with the service account with the appropriate role (e.g. Editor in able to push.)

I shared the script with the account's email ( xxxxxxxxxx@myproject.iam.gserviceaccount.com ) as Editor.
$ clasp pull --adc was successful.

$ clasp pull --adc
└─ dist/appsscript.json
└─ dist/index.js
Pulled 2 files.

But I got this when I ran $ clasp push --adc

User has not enabled the Apps Script API. Enable it by visiting https://script.google.com/home/usersettings then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

Sorry if I miss some configurations and this is not an issue. But at this moment, the App Script document (the link is also provided at the bottom of README ) says

The Apps Script API does not work with service accounts.

I was wondering if push or deploy is ever possible. I am not sure if this is related, but Domain-wide delegation scope for the service account is like this.

https://www.googleapis.com/auth/script.projects
https://www.googleapis.com/auth/script.deployments
https://www.googleapis.com/auth/script.webapp.deploy
https://www.googleapis.com/auth/drive.metadata.readonly
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/service.management
https://www.googleapis.com/auth/logging.read
https://www.googleapis.com/auth/userinfo.email
https://www.googleapis.com/auth/userinfo.profile
https://www.googleapis.com/auth/cloud-platform
https://www.googleapis.com/auth/drive

Specifications

  • Node version (node -v):v22.14.0
  • Version (clasp -v):3.0.3-alpha
  • OS (Mac/Linux/Windows):Mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions