# Nuxt asyncData Error when deploying as static

**URL:** <https://community.prismic.io/t/nuxt-asyncdata-error-when-deploying-as-static/1322>\
**Category:** Developing with Prismic\
**Tags:** nuxtjs\
**Created:** [July 22, 2020, 5:24pm UTC](https://community.prismic.io/t/nuxt-asyncdata-error-when-deploying-as-static/1322 "2020-07-22T17:24:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kolbykruger](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/kolbykruger/32/601_2.png) [@kolbykruger](https://community.prismic.io/u/kolbykruger)\
**Post date:** [July 22, 2020, 5:24pm UTC](https://community.prismic.io/t/nuxt-asyncdata-error-when-deploying-as-static/1322/1 "2020-07-22T17:24:29Z")

</div>

Hi All,

I was just reading [a post](https://nuxtjs.org/blog/going-full-static/) about the ability to now serve nuxt in a `static` mode. When trying this on my current project, I am having some issues when the site is fetching data.

Currently, I am using `asyncData` to grab my data via Prismic, to then populate the page. This looks like this:

```
async asyncData({ $prismic, error }) {
try {
  const about = await $prismic.api.query(
    $prismic.predicates.at("document.type", "about")
  );

  return {
    doc: about.results[0]
  };
} catch (e) {
  error({
    statusCode: 404,
    message: "Page not found"
  });
}
}

```

When clicking to the about page in this case (from a `nuxt-link`) I hit the 404 page, but refreshing the page when the URL is on the about page gives me the correct data and display.

For reference, I am using the [nuxt.js sample](https://user-guides.prismic.io/en/articles/2831943-nuxt-js-sample-multi-page-website-with-navigation) from Prismic that has been modified with my data. I am also deploying to Netlify, if that makes a difference.

Any ideas?

Thank you much!

---

<div class="post-metadata">

**Author:** ![juliandreas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/juliandreas/32/498_2.png) [@juliandreas](https://community.prismic.io/u/juliandreas)\
**Post date:** [July 23, 2020, 6:34am UTC](https://community.prismic.io/t/nuxt-asyncdata-error-when-deploying-as-static/1322/2 "2020-07-23T06:34:19Z")

</div>

I could be wrong, but I think you need this in your `nuxt.config.js`

```
generate: {
  fallback: '404.html'
}

```

Or if you’re using a Nuxt version \> 2.13

```
export: {
  fallback: true,
},
```

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [July 23, 2020, 3:16pm UTC](https://community.prismic.io/t/nuxt-asyncdata-error-when-deploying-as-static/1322/5 "2020-07-23T15:16:53Z")

</div>

Hey Kolby,

Welcome to the community!

Do you have a link to your github repo for this so we can check it out?

Thanks.

---

<div class="post-metadata">

**Author:** ![kolbykruger](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/kolbykruger/32/601_2.png) [@kolbykruger](https://community.prismic.io/u/kolbykruger)\
**Post date:** [July 23, 2020, 6:01pm UTC](https://community.prismic.io/t/nuxt-asyncdata-error-when-deploying-as-static/1322/6 "2020-07-23T18:01:47Z")

</div>

Hi Phil,

I sure do! Here’s the link to the repo: [https://github.com/kolbykruger/kolby-kruger](https://github.com/kolbykruger/kolby-kruger)

It’s still a very _in progress_ personal project.

I am fairly new to using Nuxt, but so far it’s been a blast to use with Prismic!

Thank you for your assistance.

---

<div class="post-metadata">

**Author:** ![juliandreas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/juliandreas/32/498_2.png) [@juliandreas](https://community.prismic.io/u/juliandreas)\
**Post date:** [July 23, 2020, 6:33pm UTC](https://community.prismic.io/t/nuxt-asyncdata-error-when-deploying-as-static/1322/7 "2020-07-23T18:33:12Z")

</div>

@kolbykruger Remove the static and crawler modules. You don’t need 'em in newer versions of nuxt.

Cool website btw!

---

<div class="post-metadata">

**Author:** ![kolbykruger](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/kolbykruger/32/601_2.png) [@kolbykruger](https://community.prismic.io/u/kolbykruger)\
**Post date:** [July 23, 2020, 7:00pm UTC](https://community.prismic.io/t/nuxt-asyncdata-error-when-deploying-as-static/1322/8 "2020-07-23T19:00:06Z")

</div>

Thank you @juliandreas, that seems to have done the trick!

I appreciate it!

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [July 24, 2020, 12:33pm UTC](https://community.prismic.io/t/nuxt-asyncdata-error-when-deploying-as-static/1322/9 "2020-07-24T12:33:44Z")

</div>

Good spot Julian!

We’ll be updating all our sample projects to full static very soon.

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [September 15, 2020, 4:45pm UTC](https://community.prismic.io/t/nuxt-asyncdata-error-when-deploying-as-static/1322/10 "2020-09-15T16:45:27Z")

</div>

closed on September 15, 2020, 4:45pm UTC, flag & select 'Something Else' to reopen.



---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 9, 2021, 5:30pm UTC](https://community.prismic.io/t/nuxt-asyncdata-error-when-deploying-as-static/1322/11 "2021-12-09T17:30:52Z")

</div>

Opened on December 9, 2021, 5:30pm UTC


