Reputation: 15353
I built an app a long time ago using Firebase and dialogflow-javascript-client.
Now, dialogflow-javascript-client is deprecated. Since dialogflow-nodejs-client-v2 is a node.js client, it is not supposed to run on Angular. Did they drop the javascript support? I can't get any answer from the devs, they just seem to avoid it.
If it is not possible, my only solution is to drop support of Dialogflow in my app.
There is absolutely not documentation or info for users migrating from Javascript, here is the only thing they give you:
Off course I tried to run it anyway, thinking it was also built to run on javascript...
But here is what I get:
WARNING in ./node_modules/google-gax/node_modules/grpc/node_modules/node-pre-gyp/lib/util/versioning.js 17:20-67 Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/google-gax/node_modules/grpc/node_modules/node-pre-gyp/lib/pre-binding.js 20:22-48 Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/google-gax/node_modules/grpc/src/grpc_extension.js 32:12-33 Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/google-gax/node_modules/grpc/node_modules/minimatch/minimatch.js Module not found: Error: Can't resolve 'path' in 'D:\ng\ww-app\node_modules\google-gax\node_modules\grpc\node_modules\minimatch'
WARNING in ./node_modules/minimatch/minimatch.js Module not found: Error: Can't resolve 'path' in 'D:\ng\ww-app\node_modules\minimatch'
ERROR in ./node_modules/dialogflow/src/v2/agents_client.js Module not found: Error: Can't resolve './agents_client_config' in 'D:\ng\ww-app\node_modules\dialogflow\src\v2'
.... (many more following)
Upvotes: 3
Views: 1168
Reputation: 2904
The dialogflow-nodejs-client-v2
only supports a node.js environment. To update your agent to V2, you should create a Cloud Function for Firebase that sends requests to dialogflow-nodejs-client-v2
, then call that Cloud Function from your Angular code rather than calling the API directly.
There is a major benefit of this approach: you will no longer have your API credentials exposed on the client side, which is a security risk.
Upvotes: 5
Reputation: 13
I found another solution: I've created a javascript client... and I get token from nodejs api getToken endpoint when it expires (that is every hour)... I have restricted the getToken endpoint to the same domain.
Upvotes: 0
Reputation: 159
I read a tutorial once with Node.js, maybe you can migrate your data from angular to Node.js like in this question anwered before.
Upvotes: 0