Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serverless-google-cloudfunctions-awesome

Package Overview
Dependencies
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-google-cloudfunctions-awesome

Provider plugin for the Serverless Framework v1.x which adds support for Google Cloud Functions.

  • 1.3.9
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
15
decreased by-21.05%
Maintainers
3
Weekly downloads
 
Created
Source

Serverless Google Cloud Functions Plugin

Coverage Status

This plugin enables support for Google Cloud Functions within the Serverless Framework.

Why is this fork AWESOME?

This repo is a fork of the official Serverless Google Cloud Functions, but adds extra features

Upgrade to Google Cloud Functions V1 and NodeJS V8

Google Cloud Functions recently got out of beta. This fork now uses their v1 instead of v1beta1. It also supports the NodeJS V8 environment, which is the default one.

To override, you can set the provider.runtime: nodejs6 option.

Region

Since it's out of beta, it now supports more than one region.

You can set it with the provier.region: us-central1 option.

See https://cloud.google.com/functions/docs/locations for supported locations.

Stating

In the serverless.yml, you can add prependService and prependStage to the provider key.

For example, the configuration below

service: users

provider:
  name: google
  runtime: nodejs6
  project: <project-id>
  credentials: <credentials>
  stage: purple
  prependService: true
  prependStage: true

functions:
  login:
    handler: login
    entryPoint: login
    events:
      - http: path

will deploy your Google Cloud Function with:

name: my-awesome-service-purple-login

handler: login // Note that the handler is not affected

trigger: https://us-central1-<project-id>.cloudfunctions.net/users-purple-login

Retry on Failure

It also adds an option to retry background jobs upon failure:

functions:
  email:
    handler: email
    entryPoint: send
    events:
      - event:
          eventType: providers/cloud.pubsub/eventTypes/topic.publish
          resource: projects/${self:provider.project}/topics/${self:provider.stage}-new-account
          retry: true

Environment Variables

Use the environment option to set environment variables.

It can be set at the provider level, or at the function level, or at both.

service: users

provider:
  name: google
  runtime: nodejs6
  project: <project-id>
  credentials: <credentials>
  stage: purple
  prependService: true
  prependStage: true
  environment:
    KEY: my-dev-key
    LANG: ca

functions:
  login:
    handler: login
    entryPoint: login
    events:
      - http: path
    environment:
      KEY: my-prod-key

The function login will have the environment variables as:

KEY: my-prod-key
LANG: ca

Special thanks to @CaptainJojo for his contribution to these awesome features.

Documentation

The documentation can be found here.


Easier development with Docker

You can spin up a Docker container which mounts this code with the following command:

docker-compose run node bash

Keywords

FAQs

Package last updated on 27 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc