Roberto Pettinau
Roberto Pettinau

Reputation: 61

Cloud Functions for Firebase: "TypeError: DialogflowApp is not a constructor"

Trying to use actions-on-google to get the user's position, but I can't seem to even make this work, any help?

'use strict';

const functions = require('firebase-functions');
const DialogflowApp = require('actions-on-google').DialogflowApp;

exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => 
{
    const app = new DialogflowApp({request, response});
    ...
}

TypeError: DialogflowApp is not a constructor at exports.dialogflowFirebaseFulfillment.functions.https.onRequest

Upvotes: 0

Views: 1470

Answers (2)

Oli Dev
Oli Dev

Reputation: 99

It is a problem within the package.json file. You have to include the right versions. For me works:

"dependencies": {
    "ajv-keywords": "^2.1.1",
    "firebase-admin": "^5.12.0",
    "firebase-functions": "^1.0.2",
    "actions-on-google": "^2.0.0",
    "firebase": "^2.4.2"
}

Upvotes: 1

I had a similar problem a few days ago. I used firebase CLI to create and build my project and I solved this problem deleting the "lib" folder that was automatically generated inside the functions folder and I built the project again.

I also added this code to package JSON:

"build": "rm -rf lib/ && tsc",

Upvotes: 0

Related Questions