v0 api

Next.js Server Action Not Callable from Client Component

Your Next.js server action defined with 'use server' directive isn't callable from client components, or throws 'function not defined' errors. Forms and onClick handlers can't invoke server actions.

Server actions fail when not properly imported, 'use server' is misplaced, or there's a server-client boundary violation in how the action is used.

Error Messages You Might See

ReferenceError: submitForm is not defined Server action not bound [server-action] Not a valid server action Function is not serializable

Common Causes

  1. 'use server' directive in client component instead of server file or top of function
  2. Server action file not properly exported or imported in client component
  3. Passing non-serializable objects to server action (functions, class instances)
  4. Server action defined in client component file with 'use client'
  5. Async/await not properly handled when calling server action

How to Fix It

Create server action file: Make separate file with 'use server' at top, export the async function:
'use server'
export async function submitForm(formData) { ... }

Import in client: In client component, import and call normally:
import { submitForm } from '@/actions'
onClick={() => submitForm(data)}

Handle async: Wrap in useTransition hook for loading state:
const [pending, startTransition] = useTransition()
startTransition(() => submitForm(data))

Pass FormData: For forms, pass FormData object directly, not individual fields.

Real developers can help you.

Kingsley Omage Kingsley Omage Fullstack software engineer passionate about AI Agents, blockchain, LLMs. Matthew Jordan Matthew Jordan I've been working at a large software company named Kainos for 2 years, and mainly specialise in Platform Engineering. I regularly enjoy working on software products outside of work, and I'm a huge fan of game development using Unity. I personally enjoy Python & C# in my spare time, but I also specialise in multiple different platform-related technologies from my day job. zipking zipking I am a technologist and product builder dedicated to creating high-impact solutions at the intersection of AI and specialized markets. Currently, I am focused on PropScan (EstateGuard), an AI-driven SaaS platform tailored for the Japanese real estate industry, and exploring the potential of Archify. As an INFJ-T, I approach development with a "systems-thinking" mindset—balancing technical precision with a deep understanding of user needs. I particularly enjoy the challenge of architecting Vertical AI SaaS and optimizing Small Language Models (SLMs) to solve specific, real-world business problems. Whether I'm in a CTO-level leadership role or hands-on with the code, I thrive on building tools that turn complex data into actionable value. Taufan Taufan I’m a product-focused engineer and tech leader who builds scalable systems and turns ideas into production-ready platforms. Over the past years, I’ve worked across startups and fast-moving teams, leading backend architecture, improving system reliability, and shipping products used by thousands of users. My strength is not just writing code — but connecting product vision, technical execution, and business impact. Caio Rodrigues Caio Rodrigues I'm a full-stack developer focused on building practical and scalable web applications. My main experience is with **React, TypeScript, and modern frontend architectures**, where I prioritize clean code, component reusability, and maintainable project structures. I have strong experience working with **dynamic forms, state management (Redux / React Hook Form), and complex data-driven interfaces**. I enjoy solving real-world problems by turning ideas into reliable software that companies can actually use in their daily operations. Beyond coding, I care about **software quality and architecture**, following best practices for componentization, code organization, and performance optimization. I'm also comfortable working across the stack when needed, integrating APIs, handling business logic, and helping transform prototypes into production-ready systems. My goal is always to deliver solutions that are **simple, efficient, and genuinely useful for the people using them.** PawelPloszaj PawelPloszaj I'm fronted developer with 10+ years of experience with big projects. I have small backend background too Nam Tran Nam Tran 10 years as fullstack developer BurnHavoc BurnHavoc Been around fixing other peoples code for 20 years. Anthony Akpan Anthony Akpan Developer with 8 years of experience building softwares fro startups MFox MFox Full-stack professional senior engineer (15+years). Extensive experience in software development, qa, and IP networking.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

Where do I define server actions?

In a separate file with 'use server' at the top, or at function level inside a server component.

Can server actions access databases?

Yes, that's their main purpose. Server actions run only on server, so database queries are safe and secret keys protected.

How do I show loading state during server action?

Use useTransition hook: const [pending] = useTransition(); pending shows true while action runs.

Related v0 Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help