# How to use Next.js with Local's WP?

**URL:** <https://community.localwp.com/t/how-to-use-next-js-with-locals-wp/38786>\
**Category:** Support\
**Created:** [August 28, 2023, 8:04pm UTC](https://community.localwp.com/t/how-to-use-next-js-with-locals-wp/38786 "2023-08-28T20:04:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sgfanega](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/sgfanega/32/19350_2.png) [@sgfanega](https://community.localwp.com/u/sgfanega)\
**Post date:** [August 28, 2023, 8:04pm UTC](https://community.localwp.com/t/how-to-use-next-js-with-locals-wp/38786/1 "2023-08-28T20:04:45Z")

</div>

### What issue or error are you experiencing?

> - error Error [TypeError]: fetch failed  
> at Object.fetch (node:internal/deps/undici/undici:14294:11)  
> at process.processTicksAndRejections (node:internal/process/task\_queues:95:5)  
> at async fetchAPI (webpack-internal:///./lib/api.ts:18:17)  
> at async getAllPostsForHome (webpack-internal:///./lib/api.ts:64:18)  
> at async getStaticProps (webpack-internal:///./pages/index.tsx:85:22) {  
> digest: undefined  
> }

* * *

### What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc

1. Spin up a local WP with WPGraphQL plugin activated.
2. Download Next.js’ [cms-wordpress](https://vercel.com/guides/wordpress-with-vercel) app.
3. Add the [http://name-of-wp.local/graphql](http://name-of-wp.local/graphql) to the .env.local file in Next.js app.
4. Try to go to localhost:3000

* * *

### System Details

- **Local Version:**  
Web Server: nginx  
PHP Version: 8.19  
Database: MySQL 8.0.16  
WordPress Version: 6.3

- **Operating System (OS) and OS version:**  
Windows for WP  
WSL2 Ubuntu for Next.js App

* * *

Additionally, if I use a live WP server and use its graphQL endpoint, it does not give me any errors and works perfectly. This might have something to do with local issues with Flywheel rather than the Next.js or JS issues.

Any advice is welcome.

---

<div class="post-metadata">

**Author:** ![Nick-B](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/nick-b/32/16140_2.png) [@Nick-B](https://community.localwp.com/u/Nick-B)\
**Post date:** [August 30, 2023, 4:54pm UTC](https://community.localwp.com/t/how-to-use-next-js-with-locals-wp/38786/2 "2023-08-30T16:54:48Z")

</div>

Hi @sgfanega!

Have you been through our help doc below? Using the Atlas Headless Add on and following the steps in there should help get you going, but let us know if you still have questions!

> **[Atlas: Headless WP Add-on](https://localwp.com/help-docs/local-features/using-the-atlas-headless-wp-add-on/)**
>
> The "Atlas: Headless WP" add-on helps you quickly get working on a Headless WordPress site using WP Engine's Atlas framework. That's a lot of jargon, so let's get you oriented in terms of what all…

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/system/32/1_2.png) [@system](https://community.localwp.com/u/system)\
**Post date:** [November 28, 2023, 4:55pm UTC](https://community.localwp.com/t/how-to-use-next-js-with-locals-wp/38786/3 "2023-11-28T16:55:28Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
