neon-functions

Deploy long-running Node.js HTTP functions on Neon branches with injected database connections.

Updated Sep 19, 2026
One-click install
npx skills add https://github.com/paramcodes/autobro --skill neon-functions-paramcodes
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: neon-functions
Source: https://github.com/paramcodes/autobro/tree/main/.grok/skills/neon-functions
Command: npx skills add https://github.com/paramcodes/autobro --skill neon-functions-paramcodes

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @neon/config, @neon/functions, @neon/env, hono, drizzle-orm, pg, and includes references (resource) components.

What problem does it solve? Lambda-style serverless functions time out on long-running workloads like AI agent streams, WebSocket servers, and SSE endpoints, and they run far from your database. This Skill guides you through defining, developing, deploying, and managing long-running serverless functions that run next to your Neon Postgres branch with DATABASE_URL injected automatically. ## Core Features & Use Cases - Long-Running Handlers: Deploy web-standard fetch handlers on Node.js 24 with a 15-minute time-to-first-byte budget, supporting streaming agents, WebSocket servers, and SSE endpoints that stay alive while bytes flow. - Branch-Scoped Backends: Each Neon branch runs its own function version at its own URL against its own isolated database, with infrastructure declared as code in neon.ts and deployed via the Neon CLI. - Function Triggers: Schedule cron invocations or react to object-storage upload events that POST to your function, with parsing helpers for delivery payloads. - Use Case: Build an AI agent with the Vercel AI SDK that streams multi-step tool-calling responses directly to the browser, queries Postgres through a pooled connection, and authenticates callers with JWT verification — all without hitting your web host's serverless timeout. ## Quick Start Ask the AI to create a Neon Function in neon.ts with a Hono handler that queries Postgres and deploy it with neon deploy.

Frequently Asked Questions about neon-functions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I deploy a long-running serverless function next to my Postgres database?▼

Declare the function in neon.ts under the functions block with a slug and source entry file, then run neon deploy. Neon injects DATABASE_URL automatically, assigns a public HTTPS URL, and runs the function in the same region as your branch's database.

How do I run an AI agent without serverless timeouts?▼

Host the agent as a Neon Function using the Vercel AI SDK or Mastra, which gives a 15-minute time-to-first-byte budget and keeps streams alive while bytes flow. Have the browser call the function directly with a bearer token rather than proxying through your web host's route handlers.

Can I run a WebSocket or SSE server on serverless functions?▼

Yes, Neon Functions support WebSocket servers via upgradeWebSocket from @neon/functions and SSE endpoints via a ReadableStream response with text/event-stream content type. Connections stay alive as long as data flows, with a 15-minute idle heartbeat window.

Does Neon Functions support cron jobs and scheduled triggers?▼

Yes, Function Triggers POST to your function on a five-field UTC cron schedule or when an object is created in a declared storage bucket. Declare triggers in neon.ts alongside functions and apply them with neon deploy, or manage them with the neon triggers CLI commands.

What are the limitations of Neon Functions?▼

Functions are available only in aws-us-east-2, aws-us-east-1, aws-eu-central-1, and aws-ap-southeast-1, run Node.js 24 with 2048 MiB fixed memory, and require a response to start within 15 minutes. They are a request/response runtime, not a background job runner, and module state does not survive isolate eviction.

Why should I use a pg pool instead of the Neon serverless driver in functions?▼

Neon Functions are long-running and reuse an isolate across many requests, so a persistent node-postgres pool created once at module scope amortizes connection setup. The serverless driver's HTTP transport is designed for fully isolated lambda-style runtimes, not reused isolates.