Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: async config details in next.config.js seems incorrect #34253

Closed
manspaniel opened this issue Feb 12, 2022 · 3 comments
Closed

Docs: async config details in next.config.js seems incorrect #34253

manspaniel opened this issue Feb 12, 2022 · 3 comments
Labels
Documentation Related to Next.js' official documentation.

Comments

@manspaniel
Copy link

What is the improvement or update you wish to see?

The docs currently state:

"Since Next.js 12.1.0, you can use an async function:"

module.exports = async (phase, { defaultConfig }) => {
  /**
   * @type {import('next').NextConfig}
   */
  const nextConfig = {
    /* config options here */
  }
  return nextConfig
}

However:

  • The latest version of Next.js is 12.0.10.
  • You currently only appear to be able to export a promise, and not an async function — otherwise you receive an error stating that the async config exists.

Is there any context that might help us understand?

Tim Neutkens tweet stating that you can export a Promise: https://twitter.com/timneutkens/status/1486075973204422665
Pull request (merged) with the new async feature: #33662

On Next v12.0.10, when exporting an async function, I receive the following error:

Error: > Promise returned in next config. https://nextjs.org/docs/messages/promise-in-next-config

Doesn't work:

module.exports = async () => {
  return {/* ... */}
}

Does work:

module.exports = (async () => {
  return {/* ... */}
})()

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

https://nextjs.org/docs/api-reference/next.config.js/introduction

@manspaniel manspaniel added the Documentation Related to Next.js' official documentation. label Feb 12, 2022
@balazsorban44
Copy link
Member

You can try this out on the canary channel for now, 12.1.0 is coming very soon!

@manspaniel
Copy link
Author

Thanks @balazsorban44!

@github-actions
Copy link
Contributor

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Related to Next.js' official documentation.
Projects
None yet
Development

No branches or pull requests

2 participants