How to fix EdgeFunctionError: Function not found in Supabase

SupabaseINTERMEDIATEHIGHUpdated Dec 29, 2025Β· 123 views

This error occurs when a request is sent to a Supabase Edge Function that doesn't exist, hasn't been deployed, or the URL is incorrect. It typically returns a 404 HTTP response with error code EF002.

Quick fix

Fixes EF002

# List your edge functions
ls -la supabase/functions/
  1. Verify the function folder exists and has correct naming
  2. Deploy or redeploy the function
  3. Test the function locally first
  4. Verify the correct endpoint URL format
supabase β€” error
# List your edge functions
ls -la supabase/functions/
EdgeFunctionError: Function not found

What this error means

Supabase Edge Functions are serverless functions built on Deno that run in response to HTTP requests. When you invoke a function using its URL endpoint, Supabase's routing system must locate and execute the corresponding function code. The "Function not found" error means the routing system couldn't find a deployed function matching your request URL. This can happen for several reasons: the function name in your URL doesn't match the deployed function folder name, the function hasn't been successfully deployed, the endpoint URL is malformed, or the function was deleted after deployment.

Typical symptoms

  • HTTP 404 response with message 'Requested function was not found'
  • Error code EF002 in response body
  • Function works locally with 'supabase functions serve' but fails when deployed
  • Function invocation returns 'Function not found' despite being listed as ACTIVE in dashboard
  • Requests to the function endpoint consistently fail with 404 errors

Common causes

  1. Function name in the URL doesn't match the folder name in supabase/functions/ directory
  2. Function hasn't been deployed yet or deployment failed silently
  3. Function was deployed but deployment used wrong function name or path
  4. Using incorrect or outdated endpoint URL format
  5. Function was deployed to wrong Supabase project or branch
  6. Attempting to call function before the deploy command completed
  7. Using npm packages with compatibility issues between local and deployed environments

How to fix "EdgeFunctionError: Function not found"

1Verify the function folder exists and has correct naming

Check that the function folder name in your supabase/functions/ directory matches exactly what you're calling in your URL.

bash
# List your edge functions
ls -la supabase/functions/

If your folder is named send_email, the URL must be:

bash
https://<project-ref>.supabase.co/functions/v1/send_email

Function names are case-sensitive. Function folder names should use underscores, not hyphens.

2Deploy or redeploy the function

Use the Supabase CLI to deploy the function. Make sure you're logged in and targeting the correct project:

bash
# Deploy a specific function
supabase functions deploy <function-name>

# Or deploy all functions
supabase functions deploy

# Verify deployment succeeded
supabase functions list

Your output should show the function with status ACTIVE. If deployment fails, check the error message for clues about syntax errors or missing dependencies.

3Test the function locally first

Before deploying, test the function locally using the Supabase CLI:

bash
# Start local Supabase environment
supabase start

# Serve edge functions locally
supabase functions serve

# In another terminal, call the function
curl http://localhost:54321/functions/v1/<function-name>

This helps identify issues before deployment. If the function works locally but fails when deployed, the problem is likely environmental (missing npm packages, dependency issues, etc.).

4Verify the correct endpoint URL format

Ensure you're using the correct URL format:

javascript
// Correct format
https://<your-project-ref>.supabase.co/functions/v1/<function-name>

// Example
https://example-abc123.supabase.co/functions/v1/send_email

// Call from JavaScript
const response = await fetch(
  'https://example-abc123.supabase.co/functions/v1/send_email',
  {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ email: 'user@example.com' }),
  }
);

Your project reference is visible in your Supabase dashboard under Project Settings > General > Project Ref.

5Check for npm package compatibility issues

If your function uses npm packages, they might work locally but fail when deployed. Some packages with native dependencies or browser-specific code won't work in Deno:

typescript
// supabase/functions/my-function/index.ts
import { serve } from 'https://deno.land/std@0.168.0/http/server.ts';

// Use JSR/Deno-compatible imports instead of npm
import { createClient } from 'jsr:@supabase/supabase-js@2.49.8';

serve(async (req) => {
  const supabase = createClient(
    Deno.env.get('SUPABASE_URL')!,
    Deno.env.get('SUPABASE_ANON_KEY')!
  );

  return new Response('Function works!');
});

Check the Supabase Edge Functions documentation for compatible packages. Run deno check index.ts locally to catch type errors before deploying.

6Verify CLI version and use --debug flag if needed

Some users have reported deploy issues with specific CLI versions. Update to the latest version:

bash
# Update Supabase CLI
npm install -g supabase@latest

# Or for a specific version that's known to work
npm install -g supabase@1.61.0

# Deploy with debug output to see what's happening
supabase functions deploy <function-name> --debug

The --debug flag will show detailed logs of the deployment process, helping you identify where the deploy is failing.

Advanced notes

Edge Functions are built on Deno, not Node.js. This means npm modules may not work directlyβ€”you must use JSR (JavaScript Registry) or Deno-compatible imports. Import paths should use full URLs or JSR imports instead of npm package names.

Known issues: Some users have reported functions work with "supabase functions serve" locally but return 404 when deployed. This is often caused by npm package compatibility issues. Using deno check locally before deploying can catch these errors early.

Branching: If using Supabase branching, ensure you're calling the function with the correct URL for the branch environment and using the corresponding anon key.

Frequently asked questions

What does "EF002" mean?
Supabase Edge Functions are serverless functions built on Deno that run in response to HTTP requests. When you invoke a function using its URL endpoint, Supabase's routing system must locate and execute the corresponding function code. The "Function not found" error means the routing system couldn't find a deployed function matching your request URL.
How do I fix "EF002"?
This error occurs when a request is sent to a Supabase Edge Function that doesn't exist, hasn't been deployed, or the URL is incorrect. It typically returns a 404 HTTP response with error code EF002.
What causes "EF002"?
Function name in the URL doesn't match the folder name in supabase/functions/ directory Function hasn't been deployed yet or deployment failed silently Function was deployed but deployment used wrong function name or path
Is the "EF002" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading