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

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

问题描述

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

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

我曾尝试在 script.google.com 上创建一个带有推送端点的订阅者,但没有成功.推送端点 URL 是使用 StateTokenBuilder API 创建的,这需要在端点 URL 上存在查询参数.查询参数进一步用于将 URL 处的任何请求转发到应用程序内的 javascript 函数.

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.

是否允许使用带有查询参数的推送端点 URL?

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

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

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?

这是我得到的错误:

  "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"
  }

谢谢!

推荐答案

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

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.

以下是使用 Pub/Sub 的新 gmail 推送通知示例.
https://github.com/Spencer-Easton/Apps-Script-Gmail-推送通知

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天全站免登陆