“找不到功能";对Web App进行GET和POST请求时出错 [英] "function not found" error when making both GET and POST requests to a Web App

查看:158
本文介绍了“找不到功能";对Web App进行GET和POST请求时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个

Script function not found: doGet

OR

Script function not found: doPost

当我获取/发布到我的Google脚本时:

when I GET/POST to my Google script:

function doGet(e){return ContentService.createTextOutput("User says")}

function doPost(e) {
  return HtmlService.createHtmlOutput(
    "<form action='http://www.example.com/users/gmail_permission/' method='post' id='foo'>" + 
    "<input type='hidden' name='gmail' value='getEmail()' >" +
    "<input type='hidden' name='id' value='e.parameter.user_id' >" +    
    "</form>" +
    "<script>document.getElementById('foo').submit();</script>");
}

function getEmail() {
  return Session.getActiveUser().getEmail();
}

奇怪的是,当我在浏览器中访问Webapp URL时,会出现上述错误.但是,当我使用Hurl.it时,我只是被重定向到Google云端硬盘.但是当我测试Web应用程序以获取您的最新代码"时.在google.script.com上,GET响应可以正常工作.

The weird thing is I'll get the above error when I visit the Webapp URL on my browser. But when I use Hurl.it, I just get redirected to Google Drive. But when I 'Test web app for your latest code.' on google.script.com, the GET response works fine.

对于正在发生的事情相当迷茫....这是我的脚本:

Pretty lost as to what is going on.... here is my script:

 https://script.google.com/macros/s/AKfycbz0XGeoEuP4V6W60N7yP-dDiLltPefxmqzhMJurnGzOhPfqA_er/exec

这是GETs

 FROM Hurl.it - GET https://accounts.google.com/ServiceLogin?service=wise&followup=https://script.google.com/macros/s/AKfycbz0XGeoEuP4V6W60N7yP-dDiLltPefxmqzhMJurnGzOhPfqA_er/exec&continue=https://script.google.com/macros/s/AKfycbz0XGeoEuP4V6W60N7yP-dDiLltPefxmqzhMJurnGzOhPfqA_er/exec&passive=1209600

 FROM script.google.com: https://script.google.com/macros/s/AKfycbyCH4Jk7VcEIhE52jIorIBzcghRYAPRuwuzFSHwaWIB/dev

 FROM browser:https://script.google.com/macros/s/AKfycbz0XGeoEuP4V6W60N7yP-dDiLltPefxmqzhMJurnGzOhPfqA_er/exec

推荐答案

最终找到了答案.

这很愚蠢,但是显然保存并重新发布您的Google脚本网络应用程序还不够好.您需要保存一个新版本并发布该新版本,以确保您的应用得到正确的更新.

It's pretty stupid, but apparently saving and republishing your google script web app is not good enough. You need to save a new version and publish the new version to make sure your app gets updated properly.

这篇关于“找不到功能";对Web App进行GET和POST请求时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆