googleapis / googleapis/google-cloud-ruby

google-analytics-data - received '13:Internal error encountered.' when running a report, and passing an incorrect shape in the `metrics` field

Aperta
#19,013 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
priority: p3 type: cleanup
Lingua principale
Ruby
Stelle
1.4k
Fork
578
Merge medio
1g 11h
PR unite (30g)
166

Descrizione

*edit: Issue is resolved, but leaving this open because this error isn't being handed on the Google side. Original below:*

Hi,

I'm working on porting a UA integration over to v4 / data v1, and and am running into this error for a very simple request. I've traced through the gem to ensure that the auth method is valid (which it should be, as `Google::Auth::UserRefreshCredentials` is a `Signet::OAuth2::Client`). Not sure what else it could be.

#### Environment details

- OS: Ubuntu 22.04.1
- Ruby version: 3.1.0
- Gem name and version: google-analytics-data v. 0.3.1

#### Steps to reproduce

1. The included script below (when filled with accurate parameters) shows the issue

#### Code example

```ruby
client_id = 'my-client-id'
client_secret = 'my-client-secret'
access_token = 'my-access-token'
refresh_token = 'my-refresh-token'
property_id = 'my-property-id'

client = ::Google::Analytics::Data.analytics_data do |config|
config.credentials = Google::Auth::UserRefreshCredentials.new(
client_id: client_id,
client_secret: client_secret,
access_token: access_token,
refresh_token: refresh_token,
scope: 'https://www.googleapis.com/auth/analytics.readonly',
expires_at: 0
)
end

report = {
property: "properties/#{property_id}",
date_ranges: [{ start_date: '2022-08-03', end_date: '2022-08-10' }],
metrics: [{ name: 'gametric', expression: 'active28DayUsers' }],
dimensions: [{ name: 'date' }]
}

client.run_report(report)
```

#### Full backtrace

```sh
/home/mpd/.rvm/gems/ruby-3.1.0/gems/google-analytics-data-v1beta-0.5.0/lib/google/analytics/data/v1beta/analytics_data/client.rb:316:in `rescue in run_report': 13:Internal error encountered.. debug_error_string:{UNKNOWN:Error received from peer ipv6:%5B2607:f8b0:4005:802::200a%5D:443 {created_time:"2022-08-10T12:31:24.496579441-07:00", grpc_status:13, grpc_message:"Internal error encountered."}} (Google::Cloud::InternalError)
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/google-analytics-data-v1beta-0.5.0/lib/google/analytics/data/v1beta/analytics_data/client.rb:278:in `run_report'
from /home/mpd/.config/JetBrains/RubyMine2022.2/scratches/scratch_22.rb:33:in `'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in `load'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in `load'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/railties-7.0.2.3/lib/rails/commands/runner/runner_command.rb:43:in `perform'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/railties-7.0.2.3/lib/rails/command/base.rb:87:in `perform'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/railties-7.0.2.3/lib/rails/command.rb:48:in `invoke'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/railties-7.0.2.3/lib/rails/commands.rb:18:in `'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/mpd/git-sources/double_loop/bin/rails:4:in `'
/home/mpd/.rvm/gems/ruby-3.1.0/gems/grpc-1.48.0-x86_64-linux/src/ruby/lib/grpc/generic/active_call.rb:29:in `check_status': 13:Internal error encountered.. debug_error_string:{UNKNOWN:Error received from peer ipv6:%5B2607:f8b0:4005:802::200a%5D:443 {created_time:"2022-08-10T12:31:24.496579441-07:00", grpc_status:13, grpc_message:"Internal error encountered."}} (GRPC::Internal)
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/grpc-1.48.0-x86_64-linux/src/ruby/lib/grpc/generic/active_call.rb:186:in `attach_status_results_and_complete_call'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/grpc-1.48.0-x86_64-linux/src/ruby/lib/grpc/generic/active_call.rb:382:in `request_response'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/grpc-1.48.0-x86_64-linux/src/ruby/lib/grpc/generic/client_stub.rb:174:in `block (2 levels) in request_response'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/grpc-1.48.0-x86_64-linux/src/ruby/lib/grpc/generic/interceptors.rb:170:in `intercept!'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/grpc-1.48.0-x86_64-linux/src/ruby/lib/grpc/generic/client_stub.rb:173:in `block in request_response'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/gapic-common-0.11.1/lib/gapic/grpc/service_stub/rpc_call.rb:121:in `call'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/gapic-common-0.11.1/lib/gapic/grpc/service_stub.rb:156:in `call_rpc'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/google-analytics-data-v1beta-0.5.0/lib/google/analytics/data/v1beta/analytics_data/client.rb:311:in `run_report'
from /home/mpd/.config/JetBrains/RubyMine2022.2/scratches/scratch_22.rb:33:in `'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in `load'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in `load'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/railties-7.0.2.3/lib/rails/commands/runner/runner_command.rb:43:in `perform'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/railties-7.0.2.3/lib/rails/command/base.rb:87:in `perform'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/railties-7.0.2.3/lib/rails/command.rb:48:in `invoke'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/railties-7.0.2.3/lib/rails/commands.rb:18:in `'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/mpd/.rvm/gems/ruby-3.1.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/mpd/git-sources/double_loop/bin/rails:4:in `'

```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with the analytics data client's run_report entry point and reproduce the request shown in the issue, including the metrics shape. Determine whether this malformed request is within the Ruby client’s scope or is handled only by Google’s service; the issue is complete only when the expected error behavior is defined and covered by a regression test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
ruby
Ambito
api
Tipo di issue
Bug
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
20/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.