#throwing error is server action is not working in production

4 messages · Page 1 of 1 (latest)

regal walrusBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

      🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in <id:customize>

      ✅ You can mark a message as the answer for your post with `Right click -> Apps -> Mark Solution`
      (if you don't see the option, try refreshing Discord with Ctrl + R)
carmine root
#

i am trying to throw error from server action and catching it in client it is working on development but it is not in production
it is giving me given below error:-
An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.

code is basically this :-

"use server"
export function action(){
if(somethingWentWrong)
throw new Error("unable to perform this task");
return ....;
}

in client side

"use client"
function Compo(){
async function onClick(){
  try{
  await action();
  }catch(err){
   console.log(err.message);
  }

///...some things render
}
can anyone tell me why?
timid verge
#

Your server action is not an async function?

icy inlet