Why am I getting a server error from the Firebase dynamic links API?

限于喜欢 提交于 2020-05-30 08:03:36

问题


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)

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

回答1:


Please use CreateShortDynamicLinkRequest instead of CreateManagedShortLinkRequest.



来源:https://stackoverflow.com/questions/50261812/why-am-i-getting-a-server-error-from-the-firebase-dynamic-links-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!