当我尝试调用作为webapp发布的GAPPS脚本时,我遇到了问题。我试图从AppEngine调用此服务。我正在使用JSON Payload对此脚本执行POST方法。 Urlfetch选项设置为遵循重定向,超时为30秒。该脚本是公开的,对匿名用户开放。
在我的本地GAE开发机器上,脚本中的URLFetch响应为200,一切正常。
当我转向生产时,脚本会被执行,但会返回错误和HTML页面。 我在URLFetch上关注了重定向,并且我将截止日期设置为30秒。
状态回复:405
回复文字:
<!DOCTYPE html><html lang="en" ><head><meta name="description" content="Web word processing, presentations and spreadsheets"><link rel="shortcut icon" href="//ssl.gstatic.com/docs/common/drive_favicon1.ico"><title>Google Drive -- Page Not Found</title><link href="//fonts.googleapis.com/css?family=Open+Sans:300" rel="stylesheet" type="text/css"><style>/* Copyright 2014 Google Inc. All Rights Reserved. */
.goog-inline-block{position:relative;display:-moz-inline-box;display:inline-block}* html .goog-inline-block{display:inline}*:first-child+html .goog-inline-block{display:inline}#drive-logo{color:#91959c;font-family:"Open Sans",Arial,sans-serif;font-size:27px;font-weight:300;position:absolute;text-shadow:0 1px 1px white;white-space:nowrap}#drive-logo img{padding:0 0.4em 0 0;position:relative;top:2px;vertical-align:middle}#drive-logo a{color:#91959c;text-decoration:none}#drive-logo span.goog-inline-block{margin-top:2px;vertical-align:top}</style><style type="text/css">body {background-color: #fff; font-family: Arial,sans-serif; font-size: 13px; margin: 0; padding: 0;}a, a:link, a:visited {color: #112ABB;}</style><style type="text/css">.errorMessage {font-size: 12pt; font-weight: bold; line-height: 150%;}</style></head><body><div style="margin: auto; max-width: 750px;"><div style="margin: 80px 40px 20px 40px; position:relative; "><div style="position: absolute; top: -80px;"><h1 id="drive-logo"><a href="/"><img src="//www.google.com/images/logos/google_logo_41.png" width="116" height="41" alt="Google logo" ><span class="goog-inline-block">Drive</span></a></h1></div><div align="center"><p class="errorMessage" style="padding-top: 50px">Sorry, the file you have requested does not exist.</p><p> Please check the address and try again. </p><div style="background: #F0F6FF; border: 1px solid black; margin-top: 35px; padding: 10px 125px; width: 300px;"><p><strong>Get stuff done with Google Drive</strong></p><p>Apps in Google Drive make it easy to create, store and share online documents, spreadsheets, presentations and more.</p><p>Learn more at <a href="https://drive.google.com/start/apps">drive.google.com/start/apps</a>.</p></div></div></div></div></body></html>
有趣的 - 没有那么多 - 是脚本在大多数情况下始终不会,但并非总是或不适用于所有用户。
您可以看到该回复标题显示Allow=HEAD, GET
,但我在我的脚本中实现了doPOst
。
尽管如此,我已经尝试通过重写整个事物以使用GET
和参数来解决这个问题,但我遇到了类似的问题!
长话短说:在GAE本地开发服务器上运行完美且状态响应200,部署到GAE时的错误响应和不稳定行为&gt;
答案 0 :(得分:0)
作为webapp运行时,GAS非常挑剔。有时,将脚本放入Google云端硬盘上的公共文件夹会有所帮助。