Google Apps Scripts - Error timetrigger not running
We at 46elks are supporting Kodcentrum with an application. They use Google Drive and Google Apps Scripts.
I created an endpoint that would be called by the Google Apps' Script every day. Everything was working fine when I was running the script manually, but when I tried to run it with a time-trigger it did not work.
I saw that the trigger did start the script by checking the script-log. But no request was made to the endpoint. Google reported that the service was unavailable whitout even trying to make a request.
I made sure that IPv4 & IPv6 was not the reason. After an extensive research I found the issue. Apparently Google service is using different systems to run manual and time-triggered tasks.
Finally I found that when saving the url to the endpoint in the script, Google server tries to read /robots.txt from the endpoint server. The endpoint server I created responded with 50X for that url. That caused Google to think the endpoint was down completely! And it would not try to make any request to any other path on the server.
To solve the issue I modified the server of the endpoint so that it would respond with 404 to all paths except the correct one, and updating the url in the Google Apps' Script solved the issue!
Written 2016-04-29 by Martin Harari Thuresson