clasp icon indicating copy to clipboard operation
clasp copied to clipboard

run-function --nondev passes the project script ID, but scripts.run requires the API-executable deployment ID

Open astradevkin opened this issue 2 months ago • 0 comments

Summary

clasp run-function always passes .clasp.json's project scriptId to scripts.run. Google documentation and the live Discovery document say this path field must contain the API-executable deployment ID. Both modes return NOT_FOUND; the equivalent raw API call succeeds with the versioned deployment ID and devMode:false.

Reproduction

  1. Create a container-bound Apps Script with function claspPing() { return "pong"; }.
  2. Link it to a standard Cloud project.
  3. Enable the Apps Script API and create a Desktop OAuth client in that project.
  4. Set executionApi.access to MYSELF and declare the required runtime scope.
  5. Create a versioned API-executable deployment with an EXECUTION_API entry point.
  6. Log clasp in with the owner account and the project scopes.
  7. Run clasp --user <PROFILE> run claspPing and repeat with --nondev.

Actual behavior

Both commands print:

Script function not found. Please make sure script is deployed as API executable.

The underlying request is:

POST /v1/scripts/<SCRIPT_ID>:run -> 404 Requested entity was not found.

Control

Using the same OAuth token and request body:

  • <SCRIPT_ID> + devMode:true -> 404
  • <SCRIPT_ID> + devMode:false -> 404
  • <API_EXECUTABLE_DEPLOYMENT_ID> + devMode:false -> 200, "pong"
  • <API_EXECUTABLE_DEPLOYMENT_ID> + devMode:true -> 404

Expected behavior

At minimum, --nondev should call scripts.run with an API-executable deployment ID and return pong. clasp could accept --deployment-id, select an unambiguous EXECUTION_API deployment, or fail early with a precise instruction.

The current NOT_FOUND message should not claim the function is missing when the API rejected the resource identifier.

Environment

  • @google/clasp: 3.2.0
  • Node.js: v26.8.1 (Homebrew)
  • OS: macOS 26.6.2
  • Account: consumer Google account; caller is script owner and deployer

References

  • https://developers.google.com/apps-script/api/reference/rest/v1/scripts/run
  • https://script.googleapis.com/$discovery/rest?version=v1
  • https://github.com/google/clasp/blob/v3.2.0/src/core/functions.ts#L73-L92

astradevkin avatar Sep 08 '26 11:09 astradevkin