How to deploy a Google Apps Script web app with clasp?

Viewed 420

I am using clasp to manage a Google Sheets Script (web app)

I tried to make a new deploy according to the instructions using: clasp deploy --deploymentId abcd1234

The command went through without errors. I can see a new version of the script created but the deployment is not updated: no deployment is made.

1 Answers

I found this conversation when digging deeper.

Summary: You need to add some code to your manifest file appscript.json:

  "webapp": {
    "access": "MYSELF",
    "executeAs": "USER_DEPLOYING"
  },

The whole appscript.json file should look like this (so you can see where to place the code:

{
  "timeZone": "America/New_York",
  "dependencies": {
  },
  "webapp": {
    "access": "MYSELF",
    "executeAs": "USER_DEPLOYING"
  },
  "exceptionLogging": "STACKDRIVER"
}

Furthermore here is an overview of the different options available:

"webapp": {
    "access": "MYSELF",
    "access": "ANYONE",
    "executeAs": "USER_DEPLOYING"
    "executeAs": "USER_ACCESSING"
    "executeAs": "ANYONE_ANONYMOUS"
  },

After updating the manifest file push the changes using clasp push. Then deploy with the commands in the instructions: clasp deploy --deploymentId abcd1234

Additional note to anyone new to clasp: there is a difference between version and deployment. A version is similar to a git tag (a way of keeping track of code), while a deployment is actual code that is being used for execution.

Related