netlify-edge-functions

Write Netlify Edge Functions for middleware, geolocation, and request manipulation on the Deno runtime.

1|Updated May 13, 2026
One-click install
npx skills add https://github.com/SyedArmanAli2003/AgroNaV --skill netlify-edge-functions-syedarmanali2003
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: netlify-edge-functions
Source: https://github.com/SyedArmanAli2003/AgroNaV/tree/main/.agents/skills/netlify-edge-functions
Command: npx skills add https://github.com/SyedArmanAli2003/AgroNaV --skill netlify-edge-functions-syedarmanali2003

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers building on Netlify need low-latency logic that runs close to users, but writing edge functions requires knowing the Deno runtime, the context.next() middleware pattern, and platform-specific APIs like Netlify.env and context.geo. This Skill provides the syntax, configuration options, and decision criteria to implement edge functions correctly. ## Core Features & Use Cases - Middleware Pattern: Intercept requests with context.next() to add authentication checks, modify response headers, or short-circuit unauthorized access. - Geolocation and Routing: Redirect users based on context.geo country, city, or timezone, and test locally with netlify dev --geo=mock. - Configuration Guidance: Covers the Config object (path, excludedPath, method, onError, cache), environment variables via Netlify.env, and import maps for Deno URL imports. - Use Case: Build an A/B testing layer that rewrites requests at the edge, or add an auth gate that returns 401 before requests reach your origin server. ## Quick Start Write a Netlify edge function that redirects German visitors to a localized /de path using geolocation.

Frequently Asked Questions about netlify-edge-functions

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

FAQPage Schema
How do I write a Netlify Edge Function?

Create a TypeScript or JavaScript file in netlify/edge-functions/ that exports a default handler receiving a Request and Context, plus a config object defining the URL path. Return a Response or call context.next() to continue the chain.

When should I use Netlify Edge Functions vs serverless functions?

Use edge functions for low-latency responses, request/response manipulation, geolocation logic, auth checks, and A/B testing. Use serverless functions for long-running operations up to 15 minutes, heavy Node.js dependencies, database work, or tasks needing over 512 MB memory.

How do I access environment variables in Netlify Edge Functions?

Use Netlify.env.get("KEY") instead of process.env or Deno.env. The Deno runtime does not support the Node.js process object, so Netlify.env is the platform-provided API for reading environment variables.

Can I use npm packages in Netlify Edge Functions?

Yes, edge functions support Node.js builtins via node: prefixes, npm packages installed normally, and Deno URL imports from CDNs like esm.sh. For URL imports, define an import map and reference it with deno_import_map in netlify.toml.

What are the limits of Netlify Edge Functions?

Edge functions have 50 ms CPU time per request, 512 MB memory per deployed set, a 40-second response header timeout, and a 20 MB compressed code size limit. Workloads exceeding these should use serverless functions instead.