Prompt
Edge function not firing on request
Latest observation
If an edge function isn’t firing on a request, the usual causes are:
1) The request path doesn’t match the function route
Make sure the function is deployed to the exact path being hit.
Example:
- Function route:
/api/edge/* - Request:
/api/edge/test✅ - Request:
/api/test❌
2) The function isn’t deployed
Verify the latest version is actually deployed, not just saved locally.
3) The request is being handled elsewhere first
Depending on your platform, a rewrite, redirect, static file, or another middleware/function may intercept the request before the edge function runs.
4) Wrong HTTP method
Some setups only trigger on specific methods if configured that way.
Example: function expects POST, but you’re sending GET.
5) Domain / environment mismatch
Make sure you’re testing the same environment where the function is deployed:
- preview vs production
- custom domain vs platform domain
6) Missing file/config conventions
On some platforms, edge functions must be placed in specific directories or registered in config.
7) Caching makes it look like it’s not running
If a cached response is served, the function may not be reached. Try:
- hard refresh
- disable cache
- use
curl - add a temporary debug header or log
8) Runtime errors prevent visible behavior
The function may be firing but crashing early. Check logs.
Quick debugging checklist
- Add a
console.log("hit edge function") - Deploy
- Send a request with
curl - Check function logs
- Confirm route/path/method match
If you want, paste:
- your edge function route/config
- the request URL
- the platform you’re using
and I can help pinpoint why it’s not firing.