NextFire main logoNextFire
Docs X
Introduction
Get Started
Clone repo
Run the app
Configuration
Firebase
Create firebase app
Authentication
Firestore
Storage
Functions
Global configuration
Public
Site config
Payments
Stripe
One time
Subscriptions
Webhooks
Usage
Project structure
Static pages
Public pages
Protected pages
Auth
Client auth
Server auth
Data fetching
Firestore client
Firestore admin
Functions
Storage
Content
Blog
Documentation
Components
Markdown
Cards
Diagrams
Filetree
Lists
Maths
Notes
Steps
Table
Tabs
Public
Deep
Deeper
Even deeper
  1. Firebase
  2. Functions

Enable Firebase Functions

Step-by-step guide to setting up Firebase Cloud Functions with TypeScript, Secret Manager, and deployment.

In this section, you’ll learn how to set up Firebase Cloud Functions for an existing Firebase project. We’ll cover creating functions, configuring TypeScript, enabling Secret Manager, and deploying your code.

While you may want to use Next.js's own API functions for your application's API, there are many scenarios where you may be required to use Firebase Functions, for example:

  1. You want to implement Authentication Blocking Functions (beforeCreate, beforeSignIn)
  2. You need to use Firebase Storage Triggers
  3. You need to use Firebase Firestore Triggers (onUserCreate, scheduled events ..) Therefore, it's essential to know how to set up Firebase Functions in a Next.js environment
1

Open Your Firebase Project

  1. Go to https://console.firebase.google.com.
  2. Select the project where you want to enable Cloud Functions.

Firebase Project Dashboard (Add screenshot: Firebase console project homepage)

2

Navigate to Functions

  1. In the left-hand menu, click Create → Functions.
  2. Note: Functions require a Pay-As-You-Go billing plan. Upgrade if necessary.
  3. Click Start to initialize Cloud Functions in your project.

Firebase Functions Section (Add screenshot: Firebase Functions overview with Start button)

3

Update TypeScript Config (Important!)

⚠️ Before deploying your functions, edit the TypeScript configuration to avoid type-checking errors.

  1. Open /functions/tsconfig.json.
  2. Under compilerOptions, add:
"skipLibCheck": true

This tells TypeScript to ignore type checks in node modules, which prevents common deployment errors.

4

Install Firebase CLI and Initialize Functions

Install Firebase CLI globally:

npm install -g firebase-tools

Initialize Firebase in your project:

firebase init
  1. When prompted, select Functions (press Spacebar) and then Enter.
  2. Always choose Use an existing project — we already created it.
  3. Follow the prompts to complete initialization.
firebase deploy

Note:

you may be asked: How many days do you want to keep container images before they're deleted? keep default value.

you may need to deploy multiple times with different errors (retry if errors of type, cannot find backend specs, timeout, cannot set IAM etc)

5

Enable Secret manager

You may need to enable secret manager API (We will need this later).

  1. Go to https://console.cloud.google.com
  2. Search for Secret Manager API
  3. Enable it
6

Ignore functions folder | Vercel

Ignore the Firebase Functions folder when deploying to Vercel Since Firebase Functions are to be deployed to Firebase, you can ignore the functions folder when deploying to Vercel. To do so, create a file named .vercelignore in the root of your project and add the following line:

functions
StorageGlobal configuration

Content

FeedbackEdit page

© 2025 Ship IT.

Rubix Studios logo