Next.js Discord

Discord Forum

What happens when I call a server action from inside of another server action?

Answered
Short-tailed Hawk posted this in #help-forum
Open in Discord
Short-tailed HawkOP
I works fine, but I remember seeing some people saying that doing this would generate another post request inside the first server action. Is this true?
Answered by B33fb0n3
No, it's not true, calling a server action inside the server env will just transform it to a normal function. It would be different if you call an endpoint via fetch method. But you are using server actions and they get transformed to normal function when called in server env
View full answer

3 Replies

@Short-tailed Hawk I works fine, but I remember seeing some people saying that doing this would generate another post request inside the first server action. Is this true?
No, it's not true, calling a server action inside the server env will just transform it to a normal function. It would be different if you call an endpoint via fetch method. But you are using server actions and they get transformed to normal function when called in server env
Answer
Short-tailed HawkOP
oh I see, thanks 👍
happy to help