Dialogflow functions: Cannot read property 'client' of undefined - actions-on-google

I've finally got user signed up with this cloud function:
const functions = require('firebase-functions');
const {
dialogflow,
Image,
} = require('actions-on-google')
// Create an app instance
const app = dialogflow()
// Register handlers for Actions SDK intents
app.intent('test', conv => {
conv.ask(new SignIn());
})
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app)
But right after that i'm getting the same error:
TypeError: Cannot read property 'client' of undefined
at Function.<anonymous> (/user_code/node_modules/actions-on-google/dist/service/dialogflow/dialogflow.js:120:71)
at next (native)
at /user_code/node_modules/actions-on-google/dist/service/dialogflow/dialogflow.js:22:71
at __awaiter (/user_code/node_modules/actions-on-google/dist/service/dialogflow/dialogflow.js:18:12)
at Function.handler (/user_code/node_modules/actions-on-google/dist/service/dialogflow/dialogflow.js:84:16)
at Object.<anonymous> (/user_code/node_modules/actions-on-google/dist/assistant.js:55:32)
at next (native)
at /user_code/node_modules/actions-on-google/dist/assistant.js:22:71
at __awaiter (/user_code/node_modules/actions-on-google/dist/assistant.js:18:12)
at standard (/user_code/node_modules/actions-on-google/dist/assistant.js:51:41)
It doesn't even get to the console.log('test'):
const functions = require('firebase-functions');
const {dialogflow} = require('actions-on-google')
// Create an app instance
const app = dialogflow()
// Register handlers for Actions SDK intents
app.intent('test', conv => {
console.log('test')
conv.ask(`response`)
})
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app)
Package.json:
{
"name": "dialogflowFirebaseFulfillment",
"description": "This is the default fulfillment for a Dialogflow agents using Cloud Functions for Firebase",
"version": "0.0.1",
"private": true,
"license": "Apache Version 2.0",
"author": "Google Inc.",
"engines": {
"node": "~6.0"
},
"scripts": {
"start": "firebase serve --only functions:dialogflowFirebaseFulfillment",
"deploy": "firebase deploy --only functions:dialogflowFirebaseFulfillment"
},
"dependencies": {
"actions-on-google": "2.1.3",
"firebase-admin": "5.12.1",
"firebase-functions": "1.0.3",
"dialogflow": "0.5.0",
"dialogflow-fulfillment": "0.4.0"
}
}

goto your action on google app Develop section, goto account linking, expand Google Sign In Client Information you will see Client ID issued by Google to your Actions copy that client id.
when initializing your app in
const app = dialogflow();
pass in an object with your actions on google account linking client id
your code should look like:
const app = dialogflow({
clientId : YOUR_APPS_CLIENT_ID
})
This will fix this issue.
To Get YOUR_APPS_CLIENT_ID, go to actions on google console, on the left nav menu, under advanced options, go to account linking and expand the third card to get your id.
Hope it helps.

Update for September 2019
If you can't find your Client ID (as it was for me, because it seems Google doesn't show it anymore within the "Google Sign In Client Information" card), then go to your Google Cloud Platform console and under APIs and Services menu, open the Credentials screen.
Then scroll to the OAuth 2.0 client IDs section and find "New Actions on Google App". The value in the last column is your Client ID for Actions on Google project.
Here is the screenshot:

I faced this issue when I didnt want to accountlink in a test project of mine, I had left accountlinking on from when I was testing something. When I connected a webhook without any clientID in the code I got the error. All I had to do was clear the accountlink settings from the Google project and then everything was solved.

Related

Unable to Access SAP Fiori Application - Error: 403 Forbidden

I have been trying out the Freestyle SAP Fiori Project and Deployed it to my Sub Account Space. It is Deployed Successfully and it is in a running state. However, when I try to access it, it says "403 Forbidden".
Screenshot 1: Error Message while Accessing the App
Screenshot 2: App Status
#Update 1: Roles, Scope, Role Templates are Empty
I went inside the deployed Application to see its Roles, Scopes & Role Templates. But all of them are empty. Can this be the reason? If yes, how do we assign them?
#Update 2: Roles, Scope, Role Templates are Empty
I have verified the MTAR Archive to see whether xs-security.json file is getting included and I can confirm it is getting included. For example, below is the content of that file.
xs-security.json
{
"xsappname": "demofiori",
"tenant-mode": "dedicated",
"description": "Security profile of called application",
"scopes": [
{
"name": "uaa.user",
"description": "UAA"
}
],
"role-templates": [
{
"name": "Token_Exchange",
"description": "UAA",
"scope-references": [
"uaa.user"
]
}
]
}

Need to report on data from Retrospectives - Azure Dev Ops

We need a way to access data through an automated way (either Rest API or some SDK) that is contained within the Retrospective Azure Dev Ops extension. Currently, there is an option to export CSV but the process is manual and limited to each Retrospective. Any ideas/thoughts?
You can try like as the following steps:
Run the API to get the information of project teams in a project.
Request URL
POST https://dev.azure.com/{organization_Name}/_apis/Contribution/HierarchyQuery?api-version=5.0-preview.1
Request Body
{
"contributionIds": ["ms.vss-admin-web.org-admin-groups-data-provider"],
"dataProviderContext": {
"properties": {
"teamsFlag": true,
"sourcePage": {
"url": "https://dev.azure.com/{organization_Name}/{project_Name}/_settings/teams",
"routeId": "ms.vss-admin-web.project-admin-hub-route",
"routeValues": {
"project": "{project_Name}",
"adminPivot": "teams",
"controller": "ContributedPage",
"action": "Execute",
"serviceHost": "{organization_Id} ({organization_Name})"
}
}
}
}
}
Run the API to list the retrospectives for a specified project team in the project.
GET https://extmgmt.dev.azure.com/{organization_Name}/_apis/ExtensionManagement/InstalledExtensions/ms-devlabs/team-retrospectives/Data/Scopes/Default/Current/Collections/{projectTeam_identityId}/Documents?api-version=3.1-preview.1
Run the API to get more details about a specified retrospective.
GET https://extmgmt.dev.azure.com/{organization_Name}/_apis/ExtensionManagement/InstalledExtensions/ms-devlabs/team-retrospectives/Data/Scopes/Default/Current/Collections/{retrospective_Id}?api-version=3.1-preview.1
However, we have not any available interface (API or CLI) to Export CSV content.

Unable to run botium for watson connector

I am trying to test Watson assistance Chatbot
{ "botium": {
"Capabilities": {
"PROJECTNAME": "IBM Watson",
"SCRIPTING_UTTEXPANSION_MODE": "all",
"SCRIPTING_FORMAT": "xlsx",
"SCRIPTING_XLSX_STARTROW": 2,
"SCRIPTING_XLSX_STARTCOL": 1,
"CONTAINERMODE": "watson",
"WATSON_APIKEY": "*********************************",
"WATSON_WORKSPACE_ID": "*********************"
} } }
but it is failing with following exception
Cannot build watson container: 'Watson workspace connection failed: { Error: Unauthorized: Access is denied due to invalid credentials.\n at Request._callback
I have provided correct credential
Skill Details Skill Name:My first skill
Skill ID:****************************
**Workspace ID:*****************************
and
API Key
Service Credentials Service Credentials Name:Service credentials-1
**Api Key:********************
Am I missing something?
Most likely, you have to adapt the Watson Service Endpoint Url using the WATSON_URL capability
And you should switch to the V2 Version of the Assistant API - https://github.com/codeforequity-at/botium-connector-watson#watson_assistant_version - using the Watson assistant ID instead of the workspace id: https://github.com/codeforequity-at/botium-connector-watson#watson_assistant_id-
"WATSON_ASSISTANT_VERSION": "V2",
"WATSON_URL": "your service endpoint",
"WATSON_APIKEY": "....",
"WATSON_ASSISTANT_ID": "....",

cordova run android takes "wrong" database

Hello fellow ionic developer,
I use visual studio code (VSC) to develop an ionic 4 application.
Situation:
Usually I emulate an API 19 Android Phone but this has to be builded everytime ionic cordova run android and I can not get it running with the -livereload flag (this takes a lot of time for even little changes). That is when I tried run the app with the cordova plugin for VSC to get a live emulator for debugging and working on my app.
Problemcontext:
I added a database for local storage of patient information. Therefore, I added a seed which provides some patient data and a user. The userlogin works like a charm, during the login I immediatly load all patients for the user. And this is were the problem is:
Apparently, the underlying database / seed is in some old state since I just changed the user values and I can not login with the new seed values.
Unhandled Promise rejection: a statement error callback did not return false: Failed to import SQL; message=sqlite3_prepare_v2 failure: table patient has 14 columns but 27 values were supplied
This is the error that brought me here.
So my question is:
Is there an opportunity to rake/prebuild/... the seed file or where is the seed file located (for using the VSC emulator, since it works on the android studio emulator but also not on the physical device) for the emulator so I can delete or redesign it.
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Android on emulator",
"type": "cordova",
"request": "launch",
"platform": "android",
"target": "emulator",
"port": 8100,
"sourceMaps": true,
"cwd": "${workspaceFolder}",
"ionicLiveReload": true
}
]
}
Thank you in advance
I found a workaround:
//DELETE FOR DEPLOY
this.deleteDatabase("databasename.db");
deleteDatabase(databasename: string)
{
try{
this.sqlite.deleteDatabase(
{
name: databasename,
location: 'default'
}
)
}
catch(error){
console.error(error)
}
}
You should delete the current database and just populate the database again with the new seed.sql
From: https://stackoverflow.com/questions/52033237/how-to-delete-sqlite-database-in-ionic3

IBM Blockchain (Hyperledger) - "Error when deploying chaincode"

I'm following the instructions to deploy some chaincode to the IBM Hyperledger Blockchain, using the swagger API on the IBM Bluemix dashboard.
In order to deploy some chaincode, I need to submit a JSON request, which contains the path to the chaincode repository:
{
"jsonrpc": "2.0",
"method": "deploy",
"params": {
"type": 1,
"chaincodeID": {
"path": "https://github.com/series0ne/learn-chaincode/tree/master/finished"
},
"ctorMsg": {
"function": "init",
"args": [
"Hello, world"
]
},
"secureContext": "user_type1_0"
},
"id": 0
}
I have logged in user_type1_0 before attempting to deploy, but this is the result I get:
{
"jsonrpc": "2.0",
"error": {
"code": -32001,
"message": "Deployment failure",
"data": "Error when deploying chaincode: Error getting chaincode package bytes: Error getting code 'go get' failed with error: \"exit status 1\"\npackage github.com/series0ne/learn-chaincode/tree/master/finished: cannot find package \"github.com/series0ne/learn-chaincode/tree/master/finished\" in any of:\n\t/opt/go/src/github.com/series0ne/learn-chaincode/tree/master/finished (from $GOROOT)\n\t/opt/gopath/_usercode_/424324290/src/github.com/series0ne/learn-chaincode/tree/master/finished (from $GOPATH)\n\t/opt/gopath/src/github.com/series0ne/learn-chaincode/tree/master/finished\n"
},
"id": 0
}
Any ideas?
P.S. Currently running commit level 0.6.1 of the Hyperledger blockchain on Bluemix.
Try stripping out the 'tree/master' portion of your deployment url. Notice that the example linked below does not include this portion of the url:
https://github.com/IBM-Blockchain/learn-chaincode#deploying-the-chaincode
This url is going to be passed into a go get <url> command inside the peer, which will download the chaincode so that it can be compiled. So, this url must match the format accepted by this command.
I tried using the Learn Chaincode example based on the advice from Dale to change the address of the repository from https://github.com/GitHub_ID/learn-chaincode/tree/master/finished to https://github.com/GitHub_ID/learn-chaincode/finished. The Blockchain network used for this test was running on Bluemix with version 0.6.1 of the Hyperledger Fabric. With the modified path, it was possible to use the APIs tab within the interface for the Blockchain network to deploy the chaincode.
Following are some things to check.
The v2.0 branch from https://github.com/IBM-Blockchain/learn-chaincode should be used with a Blockchain network running Hyperledger Fabric version 0.6.1. Is your personal fork even with the v2.0 branch from https://github.com/IBM-Blockchain/learn-chaincode?
Was the chaincode deployment issued from the same validating peer used to register the user_type1_0 user? The validating peer can be selected at the top of the APIs tab. There is a note in the Learn Chaincode instructions indicating that the same validating peer must register the user and deploy the chaincode.
Your go get is command either not able to access Location of your package due to ACL or its parameters are invalid as per IBM doc. Please recheck its format