TypeError: no implicit conversion of Pathname into String
connor-t opened this issue · 4 comments
I get the following error when initialising
@client = LazyGoogleAnalytics::Client.new()
TypeError: no implicit conversion of Pathname into String
from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/google-api-client-0.6.4/lib/google/api_client/auth/key_utils.rb:35:in initialize' from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/google-api-client-0.6.4/lib/google/api_client/auth/key_utils.rb:35:in
new'
from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/google-api-client-0.6.4/lib/google/api_client/auth/key_utils.rb:35:in block in load_from_pkcs12' from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/google-api-client-0.6.4/lib/google/api_client/auth/key_utils.rb:86:in
call'
from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/google-api-client-0.6.4/lib/google/api_client/auth/key_utils.rb:86:in load_key' from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/google-api-client-0.6.4/lib/google/api_client/auth/key_utils.rb:34:in
load_from_pkcs12'
from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/google-api-client-0.6.4/lib/google/api_client/auth/pkcs12.rb:37:in load_key' from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/lazy_google_analytics-0.1.6/lib/lazy_google_analytics/auth.rb:8:in
initialize'
from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/lazy_google_analytics-0.1.6/lib/lazy_google_analytics/client.rb:9:in new' from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/lazy_google_analytics-0.1.6/lib/lazy_google_analytics/client.rb:9:in
initialize'
from (irb):10:in new' from (irb):10 from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in
start'
from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in start' from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0/lib/rails/commands.rb:64:in
<top (required)>'
from script/rails:6:in `require'
this is a problem with ruby 1.9 and up I think
changing
config.key_file = Rails.root + "/config/xxxx-privatekey.p12"
by adding to_s fixes the problem
config.key_file = Rails.root.to_s + "/config/xxxx-privatekey.p12"
I get another error from the api client gem asking for :application_name and :application_version
can these be set from the config file?
Google::APIClient - Initializing client with options {}
Google::APIClient - Please provide :application_name and :application_version when initializing the client
Signet::AuthorizationError: Authorization failed. Server message:
{
"error" : "invalid_grant"
}
from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/signet-0.4.5/lib/signet/oauth_2/client.rb:873:in fetch_access_token' from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/signet-0.4.5/lib/signet/oauth_2/client.rb:888:in
fetch_access_token!'
from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/google-api-client-0.6.4/lib/google/api_client/auth/jwt_asserter.rb:116:in authorize' from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/lazy_google_analytics-0.1.6/lib/lazy_google_analytics/auth.rb:14:in
authorize'
from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/lazy_google_analytics-0.1.6/lib/lazy_google_analytics/client.rb:10:in initialize' from (irb):1:in
new'
from (irb):1
from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in start' from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in
start'
from /Users/batman/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0/lib/rails/commands.rb:64:in <top (required)>' from script/rails:6:in
require'
from script/rails:6:in `
ignore the last comment, the "invalid_grant" was due to an error in copying the email address!
application_name and version are not needed
Hi @TheBatman , thanks for reporting!
Im going to close this for now , but you can reopen or report new issue anytime
regards