Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabaseβ€’3mo agoβ€’
6 replies
welydev

Edge Function 500 error : Different behavior in different supabase projects

Hello there πŸ‘‹ ,
I'm having trouble understanding my current issue and I'm running out of possible solution...

Issue : When I invoke my search-word edge function, I get a 500 error in the invocation logs.

Details
- I have two projects in supabase : prod and dev
- In both projects I have the same edge functions : search-word & prepare-training-data with similar setup : NO Verify JWT with legacy secret
- prepare-training-data works well in both projects (invoked and logs are ok)
- search-word works well in dev project (invoked and logs are ok)
- search-word is never invoked in prod project and I get a 500 http error in the invocation logs

This is how I invoke both :
// in searchWord.ts
export async function searchWord(word: string): Promise<WordSearchResult | WordSearchError> {
  try {
    const { data: { session } } = await supabase.auth.getSession();
    if (!session) {
      return {
        error: 'User not authenticated',
        errorKey: 'auth.errors.notAuthenticated'
      };
    }
    const { data, error: errorData } = await supabase.functions.invoke('search-word', {
      body: JSON.stringify({ word: word.trim() }),
    });
    ...
}
// in searchWord.ts
export async function searchWord(word: string): Promise<WordSearchResult | WordSearchError> {
  try {
    const { data: { session } } = await supabase.auth.getSession();
    if (!session) {
      return {
        error: 'User not authenticated',
        errorKey: 'auth.errors.notAuthenticated'
      };
    }
    const { data, error: errorData } = await supabase.functions.invoke('search-word', {
      body: JSON.stringify({ word: word.trim() }),
    });
    ...
}

// in trainingData.ts 
  try {
    const { data: { session } } = await supabase.auth.getSession();
    if (!session) {
      return {
        error: 'User not authenticated',
        errorKey: 'auth.errors.notAuthenticated'
      };
    }
    const { data, error } = await supabase.functions.invoke('prepare-training-data');
    if (error) {
      console.error('Error calling prepare-training-data function:', error);
      return {
        error: 'Failed to fetch training data',
        errorKey: 'training.errors.fetchFailed',
        message: error.message
      };
    }
    ...
}
// in trainingData.ts 
  try {
    const { data: { session } } = await supabase.auth.getSession();
    if (!session) {
      return {
        error: 'User not authenticated',
        errorKey: 'auth.errors.notAuthenticated'
      };
    }
    const { data, error } = await supabase.functions.invoke('prepare-training-data');
    if (error) {
      console.error('Error calling prepare-training-data function:', error);
      return {
        error: 'Failed to fetch training data',
        errorKey: 'training.errors.fetchFailed',
        message: error.message
      };
    }
    ...
}
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Edge Function returning 500 when querying table (Supabase)
SupabaseSSupabase / help-and-questions
9h ago
Supabase Custom SMTP & Edge Function Email Behavior (AWS SES)
SupabaseSSupabase / help-and-questions
2mo ago
Edge Function 500 error and time out.
SupabaseSSupabase / help-and-questions
3d ago
Mobile APP invoking edge function - error 500
SupabaseSSupabase / help-and-questions
14mo ago