Encounter "rpc error" when trying google ads through golang client

101 views
Skip to first unread message

Tao

unread,
Dec 31, 2019, 4:10:59 AM12/31/19
to AdWords API and Google Ads API Forum
Hi Google Supports,

Originally, our app was using AWQL to get the report data. Nowdays, we are just trying google ads api to fetch report data. For our app was develped by golang, so I am trying the golang version from: "google.golang.org/genproto/googleapis/ads/googleads/v2/services".  Hear are my sample codes:

googleAdsService := services.NewGoogleAdsServiceClient(client.Conn())

// Create a search request
request := services.SearchGoogleAdsRequest{
CustomerId: "1234567890", // here just faked
Query: "SELECT campaign.id, campaign.name FROM campaign",
}

// Get the results
response, err := googleAdsService.Search(client.Context(), &request)

if err != nil {
fmt.Printf("err:%v\n", err)
} else {
for _, row := range response.Results {
campaign := row.Campaign
fmt.Printf("id: %d, name: %s\n", campaign.Id.Value, campaign.Name.Value)
}
}

I always received the response:
err:rpc error: code = Internal desc = Internal error encountered.

When the credentiuals is wrong, the response instead of above will be:
panic: oauth2: cannot fetch token: 400 Bad Request
Response: {
  "error": "invalid_grant",
  "error_description": "Bad Request"
}
So I'm sure the credentials is correct, which I am using to fetch data through AWQL.

Thanks for your help.

Tao 

Hallf Ledsh

unread,
Jan 2, 2020, 4:49:04 AM1/2/20
to AdWords API and Google Ads API Forum
me too

Google Ads API Forum Advisor Prod

unread,
Jan 3, 2020, 11:59:56 AM1/3/20
to acenciolup...@gmail.com, adwor...@googlegroups.com

Hello,

Thank you for writing to us regarding your concern. The error "Internal Error Encountered" could be transient and retrying the request generally resolves the issue. Also, we do not have client libraries for Go language. If you are facing any issues related to that library, you could file an issue on the Github issue tracker. The Google Ads API Beta has the client libraries and examples available in the programming languages specified here. Additionally, you could make API calls to the Google Ads API beta via the CURL requests mentioned here. Let me know if you have any further API related concerns.

Regards,
Nikisha Patel, Google Ads API Team



ref:_00D1U1174p._5001UOFYBt:ref
Reply all
Reply to author
Forward
0 new messages