Google Webhooks getting this error: pushInvalidTtl: Invalid ttl value for channel

Google Webhooks getting this error: pushInvalidTtl: Invalid ttl value for channel

尝试订阅 Google 表格网络钩子时,我正在设置过期时间但收到错误消息:

pushInvalidTtl: Invalid ttl value for channel -1477712661

这是我正在拨打的电话:

Google::Apis::DriveV3::Channel.new(
  id: self.id,
  address: "https://#{ENV['DOMAIN']}/api/google/webhook",
  type: "web_hook",
  resource_id: resource_id,
  expiration: (Time.current + 99.years).to_i
)

Google 期望 Unix 时间戳以毫秒为单位,当过期设置如下时,上述调用有效:

Google::Apis::DriveV3::Channel.new(
  id: self.id,
  address: "https://#{ENV['DOMAIN']}/api/google/webhook",
  type: "web_hook",
  resource_id: resource_id,
  expiration: (Time.current + 1.week).to_i * 1000
}

此外,Google 不允许您订阅 webhook 超过一周。