vercel / next.js

The React Framework
https://nextjs.org
MIT License
127.07k stars 27.01k forks source link

Docs: forms-and-mutations#convention does not explain the Server Actions feature flag #59322

Closed amunrarara closed 11 months ago

amunrarara commented 11 months ago

What is the improvement or update you wish to see?

While setting up Server Actions, I'm receiving the following error:

Error: 
  × To use Server Actions, please enable the feature flag in your Next.js config. Read more: https://nextjs.org/docs/app/building-your-application/data-fetching/forms-and-mutations#convention

The docs do not have any reference to this feature flag.

Is there any context that might help us understand?

Where do I enable this flag?

Does the docs page already exist? Please link to it.

https://nextjs.org/docs/app/building-your-application/data-fetching/forms-and-mutations#convention

delbaoliveira commented 11 months ago

Hey @amunrarara 👋🏼

Thank you for raising this, we're working on updating the Server Actions docs here: https://github.com/vercel/next.js/pull/59080. Let's us know if you have any further feedback 🙏🏼

In Next.js 14, the flag is not needed. But if you're using an earlier version, you can upgrade or add the flag to your next.config.js file:

/** @type {import('next').NextConfig} */
const config = {
  experimental: {
    serverActions: true,
  },
};

module.exports = config;
github-actions[bot] commented 11 months ago

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.