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
ReferenceError: submitForm is not definedServer action not bound[server-action] Not a valid server actionFunction 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.

BurnHavoc BurnHavoc Been around fixing other peoples code for 20 years. Milan Surelia Milan Surelia Milan Surelia is a Mobile App Developer with 5+ years of experience crafting scalable, cross-platform apps at 7Span and Meticha. At 7Span, he engineers feature-rich Flutter apps with smooth performance and modern UI. As the Co-Founder of Meticha, he builds open-source tools and developer-focused products that solve real-world problems. Expertise: 💡 Developing cross-platform apps using Flutter, Dart, and Jetpack Compose for Android, iOS, and Web. 🖋️ Sharing insights through technical writing, blogging, and open-source contributions. 🤝 Collaborating closely with designers, PMs, and developers to build seamless mobile experiences. Notable Achievements: 🎯 Revamped the Vepaar app into Vepaar Store & CRM with a 2x performance boost and smoother UX. 🚀 Launched Compose101 — a Jetpack Compose starter kit to speed up Android development. 🌟 Open source contributions on Github & StackOverflow for Flutter & Dart 🎖️ Worked on improving app performance and user experience with smart solutions. Milan is always happy to connect, work on new ideas, and explore the latest in technology. Kingsley Omage Kingsley Omage Fullstack software engineer passionate about AI Agents, blockchain, LLMs. Omar Faruk Omar Faruk As a Product Engineer at Klasio, I contributed to end-to-end product development, focusing on scalability, performance, and user experience. My work spanned building and refining core features, developing dynamic website templates, integrating secure and reliable payment gateways, and optimizing the overall system architecture. I played a key role in creating a scalable and maintainable platform to support educators and learners globally. I'm enthusiastic about embracing new challenges and making meaningful contributions. Tejas Chokhawala Tejas Chokhawala Full-stack engineer with 5 years experience building production web apps using React, Next.js and TypeScript. Focused on performance, clean architecture and shipping fast. Experienced with Supabase/Postgres backends, Stripe billing, and building AI-assisted developer tools. Mehdi Ben Haddou Mehdi Ben Haddou - Founder of Chessigma (1M+ users) & many small projects - ex Founding Engineer @Uplane (YC F25) - ex Software Engineer @Amazon and @Booking.com 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. Matthew Butler Matthew Butler Systems Development Engineer @ Amazon Web Services 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. PawelPloszaj PawelPloszaj I'm fronted developer with 10+ years of experience with big projects. I have small backend background too

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