# Error fetching data using nextjs typescript

**URL:** https://community.prismic.io/t/error-fetching-data-using-nextjs-typescript/12181
**Category:** Developing with Prismic
**Created:** [January 14, 2023, 8:07pm UTC](https://community.prismic.io/t/error-fetching-data-using-nextjs-typescript/12181 "2023-01-14T20:07:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![development9](https://avatars.discourse-cdn.com/v4/letter/d/41988e/32.png) [@development9](https://community.prismic.io/u/development9)
#### Post date: [January 14, 2023, 8:07pm UTC](https://community.prismic.io/t/error-fetching-data-using-nextjs-typescript/12181/1 "2023-01-14T20:07:33Z")

</div>

Hello i am trying to fetch data using the example in the docs for typescript but i keep getting an error

this is the code

```auto
export async function getStaticProps({ previewData }: GetStaticPropsContext) {
  const client = createClient({ previewData });
  // ^ Automatically contains references to document types

  const page = await client.getSingle('home');
  // ^ Typed as PageDocument
  console.log(page.data);

  return {
    props: {
      page,
    },
  };
}

```

This is the Error i get:

Server Error

Error: No documents were returned

Please can anyone help

---

<div class="post-metadata">

### Author: ![development9](https://avatars.discourse-cdn.com/v4/letter/d/41988e/32.png) [@development9](https://community.prismic.io/u/development9)
#### Post date: [January 15, 2023, 5:40pm UTC](https://community.prismic.io/t/error-fetching-data-using-nextjs-typescript/12181/2 "2023-01-15T17:40:24Z")

</div>

I have been able to fix it... for some reason i skipped the publish button
