Could not load the default credentials? (Node.js Google Compute Engine tutorial)

后端 未结 14 1612
情话喂你
情话喂你 2020-12-04 19:20

SITUATION:

I follow this tutorial: https://cloud.google.com/nodejs/tutorials/bookshelf-on-compute-engine

Everything works fine until I do

14条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 19:45

    I also had this error problem, here I had not created the object of

    keyFilename (stores the credentials of the api)

    in the sessionClient object for nodejs app.

    const sessionClient = new dialogflow.SessionsClient({
                    keyFilename: "./keyCredentials.json"  
           });
            
               const sessionPath = sessionClient.sessionPath(projectId, sessionId);

    To download 'keyCredentials.json' goto:

    https://console.cloud.google.com/apis/credentials/serviceaccountkey

    Also add the path of this file to the system variables

    1. In windows open powershell
    2. type GOOGLE_APPLICATION_CREDENTIALS = [PATH_TO_SERVICE_ACCOUNT_JSON_FILE]

提交回复
热议问题