Error when authenticating with service account in docker image

173 views
Skip to first unread message

Adélaïde Bonhoure

unread,
Mar 15, 2022, 1:58:38 PM3/15/22
to Google Ads API and AdWords API Forum
Hello, 

I am trying to connect to my Google Ads Seat through Google Ads API. 
I have the simple following code to authenticate. 

###
from google.ads.googleads.client import GoogleAdsClient
DEVELOPER_TOKEN = "xxxx"  => Developer token in string
USE_PROTO_PLUS = "true"
JSON_KEY_FILE_PATH = '/app/service-account.json'  ==> the absolute path in string of the service account json file within the docker image which has been authorized for adwords scope
IMPERSONATED_EMAIL = "em...@gmail.com"  ==> the email of the admin on this service account in string
LOGIN_CUSTOMER_ID = "0123456789"  ==> The ID in string of my Google Ads Seat 

credentials = {
                    "developer_token":  DEVELOPER_TOKEN ,
                    "use_proto_plus":  USE_PROTO_PLUS ,
                    "json_key_file_path":  JSON_KEY_FILE_PATH ,
                    "impersonated_email":  IMPERSONATED_EMAIL ,
                    "login_customer_id":  LOGIN_CUSTOMER_ID
                }
client = GoogleAdsClient.load_from_dict(credentials)
###

When I run it locally it works perfectly (in locally deployed docker image). However, when my application is deployed and run in docker image on Google Cloud Platform I have the following error : "[Errno 21] Is a directory: '/app/service-account.json' ". 
I am kind of lost because this code works perfectly locally. I don't understand why it's reading this JSON_KEY_FILE_PATH variable as a directory and not as a path since it has the .json extension. 
Do you know where this could come from ? 

Thanks in advance, 

Adelaide

Google Ads API Forum Advisor

unread,
Mar 16, 2022, 12:53:06 AM3/16/22
to adel...@armis.tech, adwor...@googlegroups.com
Hi Adelaide,

Thank you for posting your concern.

Since the issue was encountered in Google Cloud Platform, then I would suggest reaching out to the Google Cloud Platform team instead via this link. I routed you to their team as handling of directory seems to be different there and the said team is more equipped to provide support on this topic.

Let me know if you have further questions as well.

Regards,
Google Logo
Ernie John
Google Ads API Team
 


ref:_00D1U1174p._5004Q2YlbTM:ref

Adélaïde Bonhoure

unread,
Mar 16, 2022, 4:19:19 AM3/16/22
to Google Ads API and AdWords API Forum
Hello, 

In fact, this is when it's deployed on Google Cloud Platform and I can see this error from the GCP logs but it's happening when I want to connect to GoogleAds Client. Even if I pass the right string argument, this authentication method send me back and error. 
I'll reach out GCP, but I'm afraid they will tell me to reach you out. 

Thank you in advance, 

Adelaide

Google Ads API Forum Advisor

unread,
Mar 16, 2022, 10:03:00 AM3/16/22
to adel...@armis.tech, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

To investigate the issue further, could you please provide us with the complete request and response logs with request-id?

Thanks,

Google Logo
Nirmita
Google Ads API Team
 

 

ref:_00D1U1174p._5004Q2YlbTM:ref

Google Ads API Forum Advisor

unread,
Mar 16, 2022, 10:05:13 AM3/16/22
to adel...@armis.tech, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

To investigate the issue further, could you please provide us with the complete request and response logs with request-id? Please Reply privately to the author option.

Thanks,

Ngon Nguyen

unread,
Mar 17, 2022, 8:19:13 PM3/17/22
to adel...@armis.tech, Google Ads API and AdWords API Forum
Chào mừng bạn đến với bảng nhớ tạm của Gboard, bất kỳ văn bản nào bạn sao chép sẽ được lưu tại đây.Sử dụng biểu tượng chỉnh sửa để ghim, thêm hoặc xóa đoạn.Nhấn vào một đoạn để dán vào hộp văn bản.Chạm và giữ một đoạn để ghim đoạn đó. Các đoạn đã bỏ ghim sẽ bị xóa sau 1 giờ.

Vào 0:58, Th 4, 16 thg 3, 2022 Adélaïde Bonhoure <adel...@armis.tech> đã viết:
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
 
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups "Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/16b50d07-917a-4747-98be-c17075c4628fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages