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.
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.
Check that the function folder name in your supabase/functions/ directory matches exactly what you're calling in your URL.
# List your edge functions
ls -la supabase/functions/If your folder is named send_email, the URL must be:
https://<project-ref>.supabase.co/functions/v1/send_emailFunction names are case-sensitive. Function folder names should use underscores, not hyphens.
Use the Supabase CLI to deploy the function. Make sure you're logged in and targeting the correct project:
# Deploy a specific function
supabase functions deploy <function-name>
# Or deploy all functions
supabase functions deploy
# Verify deployment succeeded
supabase functions listYour output should show the function with status ACTIVE. If deployment fails, check the error message for clues about syntax errors or missing dependencies.
Before deploying, test the function locally using the Supabase CLI:
# 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.).
Ensure you're using the correct URL format:
// 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: '[email protected]' }),
}
);Your project reference is visible in your Supabase dashboard under Project Settings > General > Project Ref.
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:
// supabase/functions/my-function/index.ts
import { serve } from 'https://deno.land/[email protected]/http/server.ts';
// Use JSR/Deno-compatible imports instead of npm
import { createClient } from 'jsr:@supabase/[email protected]';
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.
Some users have reported deploy issues with specific CLI versions. Update to the latest version:
# Update Supabase CLI
npm install -g supabase@latest
# Or for a specific version that's known to work
npm install -g [email protected]
# Deploy with debug output to see what's happening
supabase functions deploy <function-name> --debugThe --debug flag will show detailed logs of the deployment process, helping you identify where the deploy is failing.
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.
email_address_not_authorized: Email sending to this address is not authorized
Email address not authorized for sending in Supabase Auth
reauthentication_needed: Reauthentication required for security-sensitive actions
Reauthentication required for security-sensitive actions
no_authorization: No authorization header was provided
How to fix "no authorization header was provided" in Supabase
otp_expired: OTP has expired
How to fix 'otp_expired: OTP has expired' in Supabase
bad_oauth_state: OAuth state parameter is missing or invalid
How to fix 'bad_oauth_state: OAuth state parameter missing' in Supabase