Hey everyone, I try to use DialogFlow (Google Cloud Dialogflow API) on my serverless project but the problem that I couldn’t find any solution for pushing google credential json file to serverless side. I followed this tutorial (it’s on google cloud website) and It works correctly on my local but not on lambda. I even tried to copy the file from webpack but It still doesn’t work. For DialogFlow, I’m using dialogflow v2 nodejs library.
I had a similar problem some time ago with accessing google API from aws lambda.
I wanted to use Google Sheets API with a python library which also needs google credentials for authentication to access the API. It worked fine on my local machine but failed on aws lambda.
The problem was that this library wanted to write something back to the credentials.json file - which of course always failed, because it is not allowed to write back to files on aws lambda(?).
I assume this is necessary for the OAuth process to update some local keys(?).
But i am not an OAuth expert - so i wasn’t able to fix this…
The solution was that i setup an Google Service Account and used the credentials from this account (instead of the Google IAM credentials) and than it worked.
Thanks for your suggestion @Franky! I found the way how to use credential file actually but the problem is a serverless framework (or aws lambda) doesn’t support grpc (google cloud API is using this). And it always gives this error:
I couldn’t find any solution for this unfortunately. I really don’t understand why It doesn’t work. I added to script on package.json for post install but It didn’t help as well.
I’m trying also to use some Google Cloud node client on AWS Lambda.
Could you explain how you manage to solve the initial problem with the Google credential .json file?
But successfully failed.
I see that you did it with the help of Google Service Account. Is there a documentation that you can provide on how to do this. Will be helpful.