plamb
plamb

Reputation: 5636

Google Execution API can't find shared function

I stepped through this example to create a Google Apps Script. I've wired up the OAuth2 credentials from a 3rd party javascript application and tried to execute my google apps script via that app. Every time I attempt to it fails with

"error": {
"code":3
"message": "ScriptError",
"details":[{
"@type:": "type.googleapis.com/google.apps.script.v1.ExecutionError",
"errorMessage": Script function not found: setData",
"errorType": "ScriptError"}]}}

I've enabled the Apps Script API on this App Script and can see the logs of the execution failing from within my Drive. I'm connecting via a chrome extension which I created Oauth2 credentials for

Also the relevent function is named 'setData': function setData(parameters) {

If I look at the Execution Transcript on setData, I see it attempting to run:

[19-01-24 16:33:39:982 PST] Starting execution 
[19-01-24 16:33:39:988 PST] Execution failed: Script function not found: setData [0 seconds total runtime]

The cruel irony is that behind the modal i can see the function 'setData' sitting there

Please let me know how to debug this

Upvotes: 0

Views: 69

Answers (1)

plamb
plamb

Reputation: 5636

Okay so the problem was that when I first selected publish -> deploy as API executable on my Google Apps Script the name of my function was different. I thought by going through that flow again after changing it, namely, publish -> deploy as API executable was enough to update my function on the Apps Script API. In fact, I had to deploy a new version of the code inside of publish -> deploy as API executable. After doing this, my chrome extension successfully connected.

Upvotes: 0

Related Questions