无法使用App Script(script.google.com)上的推送端点创建订阅 [英] Unable to create subscription with a push end point on App Script (script.google.com)

查看:100
本文介绍了无法使用App Script(script.google.com)上的推送端点创建订阅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用Google App Script上的Pub / Sub REST API。



我尝试过,没有成功,创建一个推送端指向script.google.com。
推送终点URL是使用 StateTokenBuilder API创建的,这需要查询参数出现在端点URL上。查询参数还用于将URL中的任何请求转发到应用程序内的JavaScript函数。



是否允许使用查询参数推送终点URL ?



但是,即使允许,我也无法在域script.google.com上注册推送端点。我需要声明除appspot.com以外的任何域的所有权。

你们知道任何解决方法吗?我做错了什么?



这是我得到的错误:

 error:{
code:400,
message:给定的无效推送端点(endpoint = https://script.google.com/macros/s/ .. ./usercallback?state = ...)。有关详细信息,请参阅https://cloud.google.com/pubsub/subscriber#create。,
status:INVALID_ARGUMENT
}

谢谢!

解决方案

我能够获得Cloud Pub / Sub使用Apps脚本。诀窍是将您的脚本发布到Chrome网上商店(您可以将其保留在草稿模式下)。这将在网站管理员工具中验证您的脚本。然后,您转到开发控制台并将发布的脚本URL添加到您的推送位置,而无需尾随/ exec。

以下是使用Pub / Sub的新gmail推送通知的示例。

https://github.com/Spencer-Easton/Apps-Script-Gmail-Push-Notifications


I have been playing around with the Pub/Sub REST API on Google App Script.

I have tried, without success, to create a subscriber with a push end point at script.google.com. The push end point URL was created with the StateTokenBuilder API, which requires a query parameter to be present on the end point URL. The query parameter is further used to forward any request at the URL to a javascript function inside the app.

Is it allowed to have a push end point URL with a query parameter?

However, even if it is allowed, I am unable to register for a push end point at the domain script.google.com. I am required to assert ownership of any domain other than appspot.com.

Do you guys know of any workaround? Am I doing something wrong?

This is the error I am getting:

  "error": {
    "code": 400,
    "message": "Invalid push endpoint given (endpoint=https://script.google.com/macros/s/.../usercallback?state=...). Refer to https://cloud.google.com/pubsub/subscriber#create for more information.",
    "status": "INVALID_ARGUMENT"
  }

Thank you!

解决方案

I was able to get Cloud Pub/Sub Working with Apps Script. The trick is to publish your script to the chrome web store (you can leave it in draft mode). This will verify your script in webmaster tools. You then go to the Dev Console and add the published URL of the script without the trailing /exec to your push locations.

Here is an example of the new gmail push notifications that uses Pub/Sub.
https://github.com/Spencer-Easton/Apps-Script-Gmail-Push-Notifications

这篇关于无法使用App Script(script.google.com)上的推送端点创建订阅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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