Skip to content

Instantly share code, notes, and snippets.

@ORESoftware
Created April 26, 2025 04:09
Show Gist options
  • Save ORESoftware/5cd31babcb46d07c940af18474e26910 to your computer and use it in GitHub Desktop.
Save ORESoftware/5cd31babcb46d07c940af18474e26910 to your computer and use it in GitHub Desktop.
error obfuscation in next.js / vercel in prod

If we have a server action like this:

'use server';

export async function serverActionRoutine(){
    throw new Error('prod error');
}

on the client, the error is obfuscated - now I know we can do this instead:

'use server';

export async function serverActionRoutine(){
try{
    throw new Error('prod error');
    } catch(error){
       return {success: false, error}
    }
}

but we have a lot of code that simply throws and re-factoring it all on front-end and backend would be unideal. I simply want to switch off error obfuscation in production - how?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment