问题
I'm using the OAuth 2.0 Playground to execute a Google App Script function. Using:
https://script.googleapis.com/v1/scripts/MSnRgD0GQVGwCP-h1YWmtpwV62A3zXXXX:run
The function is very simple, it just pauses for a set amount of time and then returns true.
function funSleep(intSeconds) {
Utilities.sleep(intSeconds * 1000);
return true;
}
If I run the function for < 55 seconds it returns:
HTTP/1.1 200 OK
Content-length: 133
X-xss-protection: 1; mode=block
X-content-type-options: nosniff
Transfer-encoding: chunked
Vary: Origin, X-Origin, Referer
Server: ESF
-content-encoding: gzip
Cache-control: private
Date: Tue, 20 Mar 2018 15:11:29 GMT
X-frame-options: SAMEORIGIN
Alt-svc: hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303335,quic=":443"; ma=2592000; v="41,39,35"
Content-type: application/json; charset=UTF-8
{
"done": true,
"response": {
"@type": "type.googleapis.com/google.apps.script.v1.ExecutionResponse",
"result": true
}
}
If I run the function for > 60 seconds it returns:
Something bad happened: 500 HTTP error. Message: 500 Server Error
Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds.
Questions:
Does the OAuth 2.0 Playground have a 1 minute timeout on the REST requests? I can't find this documented anywhere and I can't see if it's possible to increase it.
I've also experimented with Postman and successfully called this function with a wait up to 4 minutes. The Google documentation states the limit is 6 minutes, but I've been unable to achieve this result. Has anyone managed a REST call through the Google App Script API of this length?
Any help would be appreciated.
来源:https://stackoverflow.com/questions/49388133/oauth-2-0-playground-timeout-limit