🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

@nx-extend/gcp-functions

Package Overview
Dependencies
Maintainers
1
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nx-extend/gcp-functions

latest
Source
npmnpm
Version
18.1.2
Version published
Weekly downloads
4.7K
-51.19%
Maintainers
1
Weekly downloads
 
Created
Source

@nx-extend/gcp-functions

@nx-extend/gcp-functions NPM package

Nx plugin to build and deploy your Google Cloud Functions.

Features

  • Deploy functions to Google Cloud Functions
  • Support for multiple trigger types (HTTP, Pub/Sub, Storage, etc.)
  • Local development runner for testing multiple functions
  • Configurable memory, timeout, and concurrency settings
  • Environment variable and secret management
  • VPC connector support

Setup

Install

npm install -D @nx-extend/gcp-functions
nx g @nx-extend/gcp-functions:init

Usage

Deploy

Deploy a function to Google Cloud:

nx deploy <function-name>

Available options:

NameTypeDefaultDescription
functionNamestring-Name of the function
entryPointstringfunctionNameEntrypoint of the file to use
triggerstring-Trigger type: http, bucket, topic, resource, event
triggerValuestring-Value of the trigger (bucket name, topic name, etc.)
runtimestringrecommendedRuntime: nodejs16, nodejs18, nodejs20, nodejs22, nodejs24, recommended
memorystring-Memory: 128MB, 256MB, 512MB, 1024MB, 2048MB, 4096MB, 8192MB, 16384MB, 32768MB
allowUnauthenticatedboolean-Whether to allow unauthenticated requests
maxInstancesnumber-Maximum number of function instances
envVarsFilestring-Path to environment variables file
envVarsobject-Environment variables object
projectstring-GCP project to deploy to
retrybooleanfalseEnable retry on failure
ingressSettingsstring-Ingress settings: all, internal-only, internal-and-gclb
egressSettingsstring-Egress settings: all, private-ranges-only
vpcConnectorstring-VPC connector name
securityLevelstring-Security level: secure-optional, secure-always
gennumber2Cloud Functions generation (1 or 2)
cpunumber1Number of CPUs
concurrencynumber1Maximum concurrent requests per instance
timeoutnumber-Function timeout in seconds
secretsarray or object-Secrets to mount into the function

Build

Build a function locally:

nx build <function-name>

Runner

This project includes a runner to run all your functions locally for development. To generate the runner:

nx g @nx-extend/gcp-functions:init-runner <name>

This will generate a main.ts file like this:

import { bootstrapRunner } from '@nx-extend/gcp-functions/runner'

/* eslint-disable @nx/enforce-module-boundaries */
bootstrapRunner(new Map([
    ['nx function project name', import('path to main of project')]
  ])
)

You can now add all your functions to the map. Make sure that the nx function project name is the same name as known by Nx (name prop of that function's project.json). The runner uses the deploy target of that project.json to determine how to serve the function (HTTP/Pub Sub/bucket event).

Examples

HTTP Function

{
  "deploy": {
    "executor": "@nx-extend/gcp-functions:deploy",
    "options": {
      "functionName": "myHttpFunction",
      "trigger": "http",
      "runtime": "nodejs20",
      "memory": "256MB"
    }
  }
}

Pub/Sub Function

{
  "deploy": {
    "executor": "@nx-extend/gcp-functions:deploy",
    "options": {
      "functionName": "myPubSubFunction",
      "trigger": "topic",
      "triggerValue": "my-topic",
      "runtime": "nodejs20"
    }
  }
}

Storage Function

{
  "deploy": {
    "executor": "@nx-extend/gcp-functions:deploy",
    "options": {
      "functionName": "myStorageFunction",
      "trigger": "bucket",
      "triggerValue": "my-bucket",
      "runtime": "nodejs20"
    }
  }
}

FAQs

Package last updated on 28 Mar 2026

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