Next.js Server Function
Call a server function from a client flow and map domain failures to safe messages.
This integration recipe is not installed in the docs app. Copy the pattern into a project with the named integration dependency.
save: {
run: async (input) => {
const result = await saveProfile(input)
if (!result.ok) throw new Error(result.code)
return result.profile
},
error: mapSafeMessage,
}