为什么我从Firebase动态链接API收到服务器错误? [英] Why am I getting a server error from the Firebase dynamic links API?
本文介绍了为什么我从Firebase动态链接API收到服务器错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用Firebase API和 google来创建托管动态链接-api-client Ruby gem .这是我正在使用的代码,并带有内联Gemfile以便于测试:
I'm trying to create a managed dynamic link using the Firebase API and the google-api-client Ruby gem. Here's the code I'm using, complete with an inline Gemfile for easier testing:
require 'bundler/inline'
gemfile(true) do
gem 'google-api-client', '~> 0.20'
end
require 'google/apis/firebasedynamiclinks_v1'
require 'cgi'
include Google::Apis::FirebasedynamiclinksV1
service = FirebaseDynamicLinksService.new.tap do |service|
service.authorization = Google::Auth::DefaultCredentials.make_creds(
json_key_io: File.open('path/to/auth.json'),
scope: ['https://www.googleapis.com/auth/firebase']
)
# do this until https://github.com/google/google-api-ruby-client/issues/652
# is fixed
service.instance_variable_set(
:@root_url, 'https://firebasedynamiclinks.googleapis.com/'
)
end
link = CGI.escape('http://example.com')
request = CreateManagedShortLinkRequest.new(
long_dynamic_link: "https://f4w25.app.goo.gl/?link=#{link}&ibi=com.foo.bar",
name: 'Test test'
)
service.create_managed_short_link(request)
此脚本因Server error (Google::Apis::ServerError)
错误.响应的正文为:
This script errors with Server error (Google::Apis::ServerError)
. The body of the response is:
{
"error": {
"code": 500,
"message": "Internal error encountered.",
"errors": [
{
"message": "Internal error encountered.",
"domain": "global",
"reason": "backendError"
}
],
"status": "INTERNAL"
}
}
推荐答案
请使用CreateShortDynamicLinkRequest
而不是CreateManagedShortLinkRequest
.
这篇关于为什么我从Firebase动态链接API收到服务器错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文