Google assistant action, no function URL - google-cloud-functions

i would like to create an action project. I have an issue when i run firebase deploy --only functions.
Before i run: npm install -g firebase-tools, firebase login, firebase init, npm install actions-on-google, npm install
Everything is working and it says: Deploy complete. But it doesnt deliver me the function URL in the CMD. Also when i look it up over here : https://console.firebase.google.com/.../functions/list it doesnt show me the URL.
Do you have any idea what i am doing wrong?
That is the Tutorial i am doing:
https://developers.google.com/actions/tools/fulfillment-hosting
Best regards
Luca

You need to export a function otherwise Firebase cannot run/deploy it. You can view some great code examples on how to make Actions on the Google Assistant with Firebase here.
The following code should help you get started.
const {dialogflow} = require('actions-on-google');
const functions = require('firebase-functions');
const app = dialogflow({debug: true});
exports.myFunction = functions.https.onRequest(app);

Related

change and update twilio serverless function

I have deployed few functions in twilio serverless.If I mistakenly delet that local file from where I deployed the function.Or if this function is deployed by someone else.As there is no way to change the functions from UI,we must have to do it from cli.
The way I found is fetching,updating,building,deploying function by providing its service ,enviornment ,function ,build,deploy sid each time by function api by curl/twilio cli.Its very tedious and error prone to provide all those sid mentioned above. there should be an easy way just like when I have all the file locally and with a one twilio cli command I can change and deploy.
Whats the easiest way to download the file from serverless to local environment to change and re-deploy it again from cli just like I did first time( just run twilio serveless:deploy )?
You can modify Twilio Functions (via the GUI) created with the serverless cli by sending the following request.
Read only services and editing in the new Functions UI
Example:
client.serverless.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
.update({uiEditable: true})
.then(service => console.log(service.friendlyName));
You can also use tooling for the severless API to make working with it incredibly easy, reference:
Deploy Twilio Functions with the Serverless extension for VSCode

Can't use danfo-js library in my google script

I wanted to find some library which is similar to pandas in Python and use it in my google script. I've found danfo-js https://github.com/opensource9ja/danfojs
And using this guide https://blog.gsmart.in/es6-and-npm-modules-in-google-apps-script/ did install it in google cloud shell
so, actually here what I did:
opened my google cloud shell
installed clasp tools
clasp login
npm install danfojs-node
created new google script using: clasp create --type standalone --title "first GAS App"
So now, I have this empty script and just wanted to check does it see the danfo-js library.
To check this I have filled it out with the following code:
function myFunction() {
const dfd = require("danfojs-node")
const tf = require("#tensorflow/tfjs-node")
let data = tf.tensor2d([[20,30,40], [23,90, 28]])
let df = new dfd.DataFrame(data)
let tf_tensor = df.tensor
console.log(tf_tensor);
tf_tensor.print()
}
After I run this script I am getting the following error message:
[20-10-18 06:17:53:783 PDT] ReferenceError: require is not defined
at myFunction(Code:2:15)
It links on the following line:
const dfd = require("danfojs-node")
Looks like the compiler doesn't know what is "danfojs-node" but I don't understand what steps did I miss.
I did install danfojs-node, using the following command in google cloud shell:
npm install danfojs-node
and using the same terminal window I created this script.. maybe I should set some link inside the script to connect to this library, but I don't know where should I do it.
Apps Script is not Node.js.
You cannot install external modules and libraries the same way you would when creating a node.js application. The supported way of using external libraries in Apps Script is by installing them through the project's resources.
So essentially, this can be done by going to the project's Resources > Libraries....
You have to check if the library you plan on using is supported by Apps Script and if so, include it using the step above.
Reference
Apps Script Libraries.

Clasp fail while running

I am using the clasp to run AppScript
Example:
clasp run myFunction dev
but its showing error here like
Requested entity was not found
please let me know why it's happening?
You need to deploy the script as "API Executable". Then add sufficient authorization scopes to call the function.

Google Cloud Function Deployment with firebase deploy: does nothing

While trying to deploy the sample Google Actions Transactions API to Google Cloud Functions using firebase as per the instructions here, I encountered a problem where the firebase deploy --only functions just hanged doing nothing (did not print any error on firebase CLI). the firebase debug logs also did not give a clue of the issue.
Please help.
Thanks!
-Kunal
I found a workaroud for this problem as mentioned here. I am trying to deploy the Google Cloud Function using Firebase from behind a corporate proxy. It appears that Firebase does not read proxy settings from the environment variables. This is an open issue.
Workaround:
Go to (on Windows)
C:\Users\YOUR_USER_NAME\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\firebase\node_modules\faye-websocket\lib\faye\websocket\client.js
And update code to use your proxy server:port-
`var Client = function(_url, protocols, options) {
options = options || {};
options.proxy = {
origin: '**YOUR_PROXY_SERVER:PORT**',
headers: {'User-Agent': 'node'},
}`
This work around can be used in DEV mode until Firebase provides permanent fix.
Enjoy!

Run Yeoman generator in debug using gulp

I'm trying to create a gulp task that will execute Yeoman generator I'm developing. I've got this working using the following task, but I'm trying to find a way to not pass in the fully qualified path to the location of my globally installed NPM modules.
The gulp plugins I've seen (gulp-shell & gulp-run) execute a command (such as npm root -g) but I can't figure out how to read the text into a variable or if there's another / easier way to get this value.
gulp.task('run-yo', function () {
spawn('node', [
'--debug',
'/Users/ac/.npm-packages/lib/node_modules/yo/lib/cli.js',
'nodehttps'], { stdio: 'inherit' });
});
You can use node which
var which = require('which');
which.sync('yo');