Vercel

Inngest enables you to host your functions on Vercel using their serverless functions platform. This allows you to deploy your Inngest functions right alongside your existing website and API functions running on Vercel.

Inngest will call your functions securely via HTTP request on-demand, whether triggered by an event or on a schedule in the case of cron jobs.

Hosting Inngest functions on Vercel

After you've written your functions using Next.js or Vercel's Express-like functions within your project, you need to serve them via the serve handler. Using the serve handler, create a Vercel/Next.js function at the /api/inngest endpoint. Here's an example in a Next.js app:

Choose the Next.js App Router or Pages Router:

import { serve } from "inngest/next";
import { client } from "../../inngest/client";
import { firstFunction, anotherFunction } from "../../inngest/functions";

export const { GET, POST, PUT } = serve({
  client: client,
  functions: [
    firstFunction,
    anotherFunction
  ]
});

Deploying to Vercel

Installing Inngest's official Vercel integration does 3 things:

  1. Automatically sets the required INNGEST_SIGNING_KEY environment variable to securely communicate with Inngest's API
  2. Automatically sets the INNGEST_EVENT_KEY environment variable to enable your application to send events (docs)
  3. Automatically syncs your app to Inngest every time you deploy updated code to Vercel - no need to change your existing workflow!
Install the Inngest Vercel integration

To enable communication between Inngest and your code, you need to either disable Deployment Protection or, if you're on Vercel's Pro plan, configure protection bypass:

Bypassing Deployment Protection

If you have Vercel's Deployment Protection feature enabled, by default, Inngest may not be able to communicate with your application. This may depend on what configuration you have set:

To work around this, you can either:

  1. Disable deployment protection
  2. Configure protection bypass (Protection bypass may or may not be available depending on your pricing plan)

Configure protection bypass

To enable this, you will need to leverage Vercel's "Protection Bypass for Automation" feature. Access to this feature may be dependent on the Vercel plan that you're paying for (please see docs linked above). Here's how to set it up:

  1. Enable "Protection Bypass for Automation" on your Vercel project
  2. Copy your secret
  3. Goto the Vercel integration settings page in the Inngest dashboard
  4. For each project that you would like to enable this for, append the secret as a query string parameter to your Inngest serve route. e.g. /api/inngest?x-vercel-protection-bypass=XYZ... (see below). Inngest will now use this parameter to communicate with your application to bypass the deployment protection.
  5. Trigger a re-deploy of your preview environment(s) (this resyncs your app to Inngest)
A Vercel protection bypass secret appended as a query string in the Inngest dashboard

⚠️ Warning - This URL is stored in the Inngest database as a plaintext value, so the bypass protection secret is not encrypted at rest in our database. In the future, we plan to store this value in a separate encrypted location.


Manually syncing apps

While we strongly recommend our Vercel integration, you can still use Inngest by manually telling Inngest that you've deployed updated functions. You can sync your app via the Inngest UI or via our API with a curl request.