0

I have the following script, which works perfectly fine, when I run it on my local PC:

library(RAdwords)

autX <- doAuth()          

data <- getData(clientCustomerId='xxx-xxx-xxxx',
                google_auth=autx
                )

However, when I try to run the very same script on my Unix-Server, then I get this error message:

Error in rjson::fromJSON(RCurl::postForm("https://accounts.google.com/o/oauth2/token",  :
  STRING_ELT() can only be applied to a 'character vector', not a 'raw'

Question: What could be the reason and how can I fix it?

By the way:

  1. I did copy the files .gitgnore and .google.auth.RData from the folder on my local PC, where I already did this authentification, to the directory on my server.
  2. If I just type doAuth() alone I do not get an error message.
nexonvantec
  • 572
  • 1
  • 5
  • 18
  • 1
    After which command does the error occur? Could you run the code in debug mode? What is the output of traceback? – jburkhardt Jun 06 '18 at 07:37
  • 1
    Can you please run this code here line for line: https://github.com/jburkhardt/RAdwords/issues/90 Does the error still occur? If, yes after which line of code? Feel free to contribute in the github issue. – jburkhardt Jun 06 '18 at 13:30

1 Answers1

1

Issue:

getData()calls the function refreshToken() that updates the authentication token of the Google AdWords API. Within the function refreshToken the RCurl command returns a raw data file instead of a character file format. rjson::fromJSON returns an error that is solved with the addition of rawToChar().

Solution:

I created a patch of the function and updated the Github development version of RAdwords.

You can install the new package version with:

require(devtools)
install_github('jburkhardt/RAdwords')
Community
  • 1
  • 1
jburkhardt
  • 675
  • 1
  • 4
  • 18