Skip to content

A playground for creating functions for Google Cloud Functions

Notifications You must be signed in to change notification settings

therynamo/test-functions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

test-functions

A set of functions for testing out Google Cloud Functions.

Building

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).

Deploying

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.

Credentials

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>"
}

Testing

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

Debugging

  1. npm run inspect --<functionName>, to run your function in debug mode
  2. npm run logs to get chrome debug url

Debugging functions emulator with Chrome DevTools

About

A playground for creating functions for Google Cloud Functions

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published