I have a problem with Action on google and my alpha - beta test users and the production version. I am using the Dialogflow-V2, when I use my app in a test mode, with the simulator or with my phone linked with my dev account everything works fine and I don't have any problem.
But I have tested my project with alpha - beta test users. I sent the Opt-in Link to my users, they can accept to be alpha - beta testers and they can launch the agent with the Invocation sample.
The Welcome intent launch is ok and then the problem appear, when use the context, because in the logs of request body exist, but it doesn't exit in the Fulfillment.
Any context exits. Also I change the Array context and now I use a parameter with only one word. I have the same problem.
package.json
{
"name": "dialogflowCFPUPVASISTENTE",
"description": "This is the dialogflowCFPUPVASISTENTE 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": "8"
},
"scripts": {
"start": "firebase serve --only functions:dialogflowCFPUPVASISTENTE",
"deploy": "firebase deploy --only functions:dialogflowCFPUPVASISTENTE"
},
"dependencies": {
"actions-on-google": "^2.2.0",
"firebase-admin": "^5.13.1",
"firebase-functions": "^2.0.2",
"dialogflow": "^0.6.0",
"dialogflow-fulfillment": "^0.6.0",
"axios": "^0.18.0",
"i18next": "^15.0.5",
"moment": "^2.24.0",
"crypto-js": "^4.0.0",
"google-auth-library": "^5.10.0"
}
}
index.js
const numero = agent.parameters.numero;
conole.log(numero);
console.log('prueba6666666 cursos1 context');
//prueba
let contexto_busqueda = agent.context.get('busqueda1');
console.log(contexto_busqueda); //HERE is UNDEFINED WHEN USE TESTER PHONE
let busqueda = contexto_busqueda.parameters.busqueda;
dialogflowFirebaseFulfillment (request body) with context "busqueda1" simple parameter "busqueda"
{
textPayload: "Dialogflow Request body: {"responseId":"5c2cb699-3ca5-4062-9e12-7dc31f0b15b6-eec93b43","queryResult":{"queryText":"el curso 2","action":"MasInfoIntent","parameters":{"numero":2},"allRequiredParamsPresent":true,"outputContexts":[{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/enviar_email1","lifespanCount":5,"parameters":{"idtoken":"xxxxx","palabra":"Java","palabra.original":"Java","numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/info_curso1","lifespanCount":5,"parameters":{"numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/actions_capability_web_browser","parameters":{"numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/actions_capability_audio_output","parameters":{"numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/actions_capability_account_linking","parameters":{"numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/actions_capability_media_response_audio","parameters":{"numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/actions_capability_screen_output","parameters":{"numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/google_assistant_input_type_voice","parameters":{"numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/busqueda1","lifespanCount":4,"parameters":{"palabra":"Java","palabra.original":"Java","busqueda":"Java","numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/__system_counters__","parameters":{"no-input":0,"no-match":0,"numero":2,"numero.original":"2"}}],"intent":{"name":"projects/cfpupv-ojcaew/agent/intents/b74cc78e-8c1c-420e-ba0d-3b6da6e18dd9","displayName":"MasInfoIntent"},"intentDetectionConfidence":1,"languageCode":"es"},"originalDetectIntentRequest":{"source":"google","version":"2","payload":{"user":{"locale":"es-ES","lastSeen":"2020-04-24T11:37:19Z","idToken":"xxxxx"
insertId: "000001-5cbd2792-582d-45b5-a99c-62c51c1daae8"
resource: {
type: "cloud_function"
labels: {3}
}
timestamp: "2020-04-24T11:37:39.685Z"
severity: "INFO"
labels: {
execution_id: "o8obosdy5d5z"
}
logName: "projects/cfpupv-ojcaew/logs/cloudfunctions.googleapis.com%2Fcloud-functions"
trace: "projects/cfpupv-ojcaew/traces/b0fb3fa3c628d8cbaef2b73c09b64775"
receiveTimestamp: "2020-04-24T11:37:40.571089537Z"
}
dialogflowFirebaseFulfillment (request body) with context "busqueda1" simple parameter "busqueda" IS WORKING
{
textPayload: "Dialogflow Request body: {"responseId":"a3703a6d-9fca-4e4d-91f3-ecb58212a0f3-eec93b43","queryResult":{"queryText":"el curso 3","action":"MasInfoIntent","parameters":{"numero":3},"allRequiredParamsPresent":true,"outputContexts":[{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/enviar_email1","lifespanCount":5,"parameters":{"idtoken":"xxxxx","palabra":"java","palabra.original":"java","numero":3,"numero.original":"3"}},{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/info_curso1","lifespanCount":5,"parameters":{"numero":3,"numero.original":"3"}},{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/actions_capability_screen_output","parameters":{"numero":3,"numero.original":"3"}},{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/actions_capability_account_linking","parameters":{"numero":3,"numero.original":"3"}},{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/actions_capability_media_response_audio","parameters":{"numero":3,"numero.original":"3"}},{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/actions_capability_audio_output","parameters":{"numero":3,"numero.original":"3"}},{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/google_assistant_input_type_voice","parameters":{"numero":3,"numero.original":"3"}},{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/busqueda1","lifespanCount":4,"parameters":{"palabra":"java","palabra.original":"java","busqueda":"java","numero":3,"numero.original":"3"}},{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/__system_counters__","parameters":{"no-input":0,"no-match":0,"numero":3,"numero.original":"3"}}],"intent":{"name":"projects/cfpupv-ojcaew/agent/intents/b74cc78e-8c1c-420e-ba0d-3b6da6e18dd9","displayName":"MasInfoIntent"},"intentDetectionConfidence":1,"languageCode":"es"},"originalDetectIntentRequest":{"source":"google","version":"2","payload":{"user":{"locale":"es-ES","lastSeen":"2020-04-24T12:07:58Z","idToken":"xxxxx","userVerificationStatus":"VERIFIED"},"conversation":{"conversationId":"ABwppHEYyiNzdo2"
insertId: "000001-3770d84b-b3e1-4610-a4e1-91f9c27573a5"
resource: {
type: "cloud_function"
labels: {3}
}
timestamp: "2020-04-24T12:08:09.311Z"
severity: "INFO"
labels: {
execution_id: "0hxf6o3oumx8"
}
logName: "projects/cfpupv-ojcaew/logs/cloudfunctions.googleapis.com%2Fcloud-functions"
trace: "projects/cfpupv-ojcaew/traces/ee0e462e5b7fcab9b45d7ef9acdcebe8"
receiveTimestamp: "2020-04-24T12:08:10.552786312Z"
}
"TypeError: Cannot read property 'parameters' of undefined at masInfo (/srv/index.js:122:29) at WebhookClient.handleRequest (/srv/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:313:44) at exports.dialogflowFirebaseFulfillment.functions.https.onRequest (/srv/index.js:173:9) at cloudFunction (/srv/node_modules/firebase-functions/lib/providers/https.js:57:9) at /worker/worker.js:783:7 at /worker/worker.js:766:11 at _combinedTickCallback (internal/process/next_tick.js:132:7) at process._tickDomainCallback (internal/process/next_tick.js:219:9)"
I think this is a problem of permissions in google cloud platform. Any idea?
Do I need another permission for alpha tester and production for using contexts?
https://cloud.google.com/dialogflow/docs/fulfillment-inline-editor
https://cloud.google.com/dialogflow/docs/fulfillment-webhook
If I use other alpha tester the project doesn't work, because although the dialogflow context exist in the request body of google cloud platform in the program is undefined. Do I must do something in action google to use the program in alpha testing or production?
Can you help me?
if(results!==null && results.length>0)
statement before the context is set. Are you sure the context is being set by the buscarCursos function when you use your phone? – Jordi