A playground for creating functions for Google Cloud Functions
A set of functions for testing out Google Cloud Functions.
npm run build
will zip up the directory. Once you’ve run that command you can upload the zip to a GCS bucket however you’d like (Using the upload zip
option in GCF is a quick way to do it).
When creating a GCF, import the zip folder from your storage bucket (or upload). Then, in the Function to execute
input field, place one of the methods exported in the main index.js
file.
Store credentials in .creds.js
in an object. It will get zipped up with the rest of the project and ignored in source control.
module.exports = {
twilioPhoneNumber: "<Phone>",
twilioAccountSid: "<SID>",
twilioAuthToken: "<AuthToken>"
}
You can use the functions-emulator to run any of the functions locally prior to deploying your function. Basic functionality of the emulator is included in the npm scripts so you don’t have to install it globally.
1) npm start
, to start up the emulator
2) npm run deploy -- <functionName> --<flags>
, to deploy your function locally
3) npm run call -- <functionName>
, to call your method
4) npm run logs
, to get logs from your function
5) npm run stop
, stops GCF emulator
1) npm run inspect --<functionName>
, to run your function in debug mode
2) npm run logs
to get chrome debug url