here is the code I'm using for getting access-token for making session entity as described here: https://dialogflow.com/docs/reference/api-v2/rest/v2/projects.agent.sessions.entityTypes previously the code was working find but suddenly it stopped working and now it is returning access-token as undefined in firebase functions, here is the code which is not working:
export const rough = functions.https.onRequest((request, response) => {
var { google } = require('googleapis');
const cred = {
serviceAccountEmail: "[email protected]",
privateKey: "-----BEGIN PRIVATE KEY-----abcdkey---END PRIVATE KEY-----\n"
}
// getting server to server OAuth token
const serviceAccountAuth = new google.auth.JWT({ // key is private key, extracted from service-account json file
email: cred.serviceAccountEmail,
key: cred.privateKey,
scopes: ['https://www.googleapis.com/auth/cloud-platform']
})
console.log(serviceAccountAuth);
const _tokenData = serviceAccountAuth.authorize().then(tokenData => {
console.log("tokenData: ", tokenData)
}) })
code is correct because this code is still working fine in my machine have a look:
code in my machine: (WORKING)
same code in firebase function: (NOT WORKING)
if i run this same function in firebase function emulator it works fine
local Emulator (WORKING)
My code started working like before automatically It was happening due to an incident in google
Investigating an issue with Cloud Functions for Firebase
Incident began at 2018-12-15 04:00 and ended at 2018-12-15 13:15 (all times are US/Pacific). https://status.firebase.google.com/incident/Functions/18044
now the incident is rollbacked and this is the reason i believe my code started working correctly once again
when i posted this question in few other places including their slack channel and different github repo of firebase and google api i realized I'm not the only person who is facing this issue, there are lot more people reporting similar issues in different services like functions and storage, that their code was working good but it is now throwing error