We want to preserve persistent values. We tried it with the following simple code, but the value was not preserved. What did we make a mistake?
index.js
'use strict';
const functions = require('firebase-functions');
const { dialogflow } = require('actions-on-google');
const app = dialogflow();
app.intent('FirstIntent', conv => {
conv.user.storage.value = 'A';
conv.followup('SecondEvent');
});
app.intent('SecondIntent', conv => {
conv.close('value is ' + conv.user.storage.value);
});
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": "8"
},
"scripts": {
"start": "firebase serve --only functions:dialogflowFirebaseFulfillment",
"deploy": "firebase deploy --only functions:dialogflowFirebaseFulfillment"
},
"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.1"
}
}
FirstIntent is called at startup. Save the persistent value in FirstIntent and raise a SecondEvent. SecondIntent is called. Read a persistent value in SecondIntent to create a response. "Value is undefined" is displayed.
We found the following log.
Billing account not configured.
External network is not accessible and quotas are severely limited.
Configure billing account to remove these restrictions
We upgraded to flame and confirmed that the log is not displayed, but the persistent value has not been saved yet. Can we solve this problem without charging?