Open onigetoc opened 4 years ago
did you use the right version on package.json file?
On Tue, Jan 28, 2020, 21:24 Gino notifications@github.com wrote:
Do not accept any packages and dependencies from Google cloud platform. I select my app. CLick modify in the menu. i use the basic index.js and json package. If a i add a package and add all dependencies from these package it do not work.
Always get error. i can't add any packages except request.
const itunes = require ('searchitunes'); const request = require('request'); const parsePodcast = require('node-podcast-parser');
'use strict'; const functions = require('firebase-functions'); const {WebhookClient} = require('dialogflow-fulfillment'); //const {card, Suggestion} = require('dialogflow-fulfillment');
// https://github.com/fvdm/nodejs-searchitunes // https://github.com/request/request // https://github.com/akupila/node-podcast-parser/blob/master/package.json //const itunesPodcasts = require('itunes-podcasts'); const itunes = require ('searchitunes'); const request = require('request'); const parsePodcast = require('node-podcast-parser');
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { const agent = new WebhookClient({ request, response }); console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers)); console.log('Dialogflow Request body: ' + JSON.stringify(request.body));
function validateEmployeeID (agent) { let pattern = /[^a-zA-Z0-9]/; if (employeeID.length !== 6) { agent.add(
The length of the Employee ID should be six characters. Please enter the correct ID.
); } else if (employeeID.match(pattern) !== null) { agent.add(Employee ID should have only letters or numbers. Please enter the correct ID.
); } else { agent.add(agent.request_.body.queryResult.fulfillmentText); agent.add(New TEST AGENT
); } }function welcome (agent) { agent.add(
Welcome to my agent!
); agent.add(agent.request_.body.queryResult.fulfillmentText); }function fallback (agent) { agent.add(
I didn't understand
); agent.add(I'm sorry, can you try again?
); }// Run the proper function handler based on the matched Dialogflow intent name let intentMap = new Map(); intentMap.set('Get Employee ID', validateEmployeeID); intentMap.set('Default Welcome Intent', welcome); intentMap.set('Default Fallback Intent', fallback); agent.handleRequest(intentMap); });
package.json
{ "name": "dialogflowFirebaseFulfillment", "description": "Dialogflow fulfillment for the Regular Expression sample", "version": "0.0.1", "private": true, "license": "Apache Version 2.0", "author": "Google Inc.", "engines": { "node": "8.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.5.0", "aws-sign2": "~0.7.0", "aws4": "^1.8.0", "caseless": "~0.12.0", "combined-stream": "~1.0.6", "extend": "~3.0.2", "forever-agent": "~0.6.1", "form-data": "~2.3.2", "har-validator": "~5.1.3", "http-signature": "~1.2.0", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", "json-stringify-safe": "~5.0.1", "mime-types": "~2.1.19", "oauth-sign": "~0.9.0", "performance-now": "^2.1.0", "qs": "~6.5.2", "safe-buffer": "^5.1.2", "tough-cookie": "~2.5.0", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2", "es6-promisify": "^6.0.0", "httpreq": "^0.4.24", "lodash": "^4.17.10", "sax": "1.1.5" } }
DEPLOY ERROR:
Function failed on loading user code. Error message: Code in file index.js can't be loaded. Did you list all required modules in the package.json dependencies? Detailed stack trace: Error: Cannot find module 'searchitunes' at Function.Module._resolveFilename (module.js:548:15) at Function.Module._load (module.js:475:25) at Module.require (module.js:597:17) at require (internal/module.js:11:18) at Object. (/srv/index.js:26:16) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dialogflow/dialogflow-fulfillment-nodejs/issues/286?email_source=notifications&email_token=ALEL3CR3QGPSZ7AGCGVPFK3RADEDHA5CNFSM4KM4TSYKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IJMRTOA, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALEL3CT7QINYSNLI7WP6FRTRADEDHANCNFSM4KM4TSYA .
I fix it weeks ago thank you
How did you fix it?
Do not accept any packages and dependencies from Google cloud platform. I select my app. CLick modify in the menu. i use the basic index.js and json package. If a i add a package and add all dependencies from these package it do not work.
Always get error. i can't add any packages except request.
const itunes = require ('searchitunes');
const request = require('request');
const parsePodcast = require('node-podcast-parser');
package.json
DEPLOY ERROR: