小编mrp*_*877的帖子

无效的主题名称不匹配

我一整天都在试图解决这个问题,但我找不到错误在哪里。我正在制作一个程序来检测我何时在我的 gmail 中收到邮件并在 Google 电子表格中写入该邮件,我正在使用 Gmail API 和 Google Apps 脚本。这是我的代码:

gs代码是:

function doPost(e) {
  var message = JSON.parse(e.postData.getDataAsString()).message
  var data = Utilities.newBlob(Utilies.base64Decode(message.data)).getDataAsString()[0];
  var ss = SpreadsheetApp.openById('1b8s5PLItCsmk8l1q0T1KHYOzjW7iDv4sRXSFvAxVFbQ').getSheets()[0];
  ss.appendRow([new Date(), message.message_id,data]);
  return 200;
}

function capturemail(){

  var WatchRes = Gmail.newWatchRequest();
  WatchRes.labelIds = ["INBOX"];
  //WatchRes.labelFilterAction = "include";
  WatchRes.topicName = "projects/proyecgmailyou/topics/mailsuc";

  var response = Gmail.Users.watch(WatchRes,"rjdelrio@uc.cl");

  Logger.log(response);

}
Run Code Online (Sandbox Code Playgroud)

函数 doPost() 我放在一个网络中:https : //script.google.com/a/uc.cl/macros/s/AKfycby8gOrWrMDkaAlgNdXNHl2J424Hvv0yu2CKKhJQW41Ka3Xa55g/exec

然后我尝试运行功能 capturemail 但出现下一个错误:

The API call to gmail.users.watch failed with the error: Invalid topicName does not match projects/sys-72285619869091378116913905/topics/* 
Run Code Online (Sandbox Code Playgroud)

很奇怪,因为我从不使用这个名字“sys-72285619869091378116913905”而且我没有在同一个地方看到它

我也允许 …

watch google-apps-script google-cloud-platform gmail-api google-cloud-pubsub

6
推荐指数
1
解决办法
751
查看次数

在 ruby​​ on rails 中将 sqlite 更改为 PostgreSQL

我在 docker 中使用 win 7,在 docker 中我在 rails 上使用 ruby​​,我做了一个与 sqlite3 配合得很好的应用程序,但是当我尝试上传到 Heroku 时,Heroku 给了我一个错误,它不支持 sqlite3 所以我有将我的应用程序数据库更改为 PostgreSQL,我做了以下更改:在我的 Gemfile 中,我评论了 gem sqlite3:

# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
#posgresql
gem 'pg'
Run Code Online (Sandbox Code Playgroud)

其次,我进行了“捆绑安装”,然后进行了 docker-compuse 构建

然后在我的 database.yml 中:

前:

default: &default
  adapter: sqlite3
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

development:
  <<: *default
  database: db/development.sqlite3

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you …
Run Code Online (Sandbox Code Playgroud)

ruby postgresql ruby-on-rails heroku docker

5
推荐指数
1
解决办法
3871
查看次数