# No documents were returned

**URL:** <https://community.prismic.io/t/no-documents-were-returned/13196>\
**Category:** Developing with Prismic\
**Tags:** nextjs\
**Created:** [May 25, 2023, 5:53am UTC](https://community.prismic.io/t/no-documents-were-returned/13196 "2023-05-25T05:53:34Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![jismonthomas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/jismonthomas/32/5961_2.png) [@jismonthomas](https://community.prismic.io/u/jismonthomas)\
**Post date:** [May 25, 2023, 5:53am UTC](https://community.prismic.io/t/no-documents-were-returned/13196/1 "2023-05-25T05:53:34Z")

</div>

I just installed the latest next js and latest Prismic slice machine. The only code that I have on my page.jsx is below:

```auto
    import { createClient } from '@prismicio/client';

    export default async function Home() {
        const client = createClient();
        const page = await client.getByUID("page", "homepage");
     //even this doesn't work
     // const page = await client.getSingle('homepage');
    
        return (
            <main className="flex min-h-screen flex-col items-center justify-between p-24">
                <div>
                    <h1>Home Page</h1>
                </div>
            </main>
        );
    }

```

I have tried every single thing I can think of but I am always getting the error "No Document were returned", in addition in terminal I get the error

```auto
 GET https://undefined.cdn.prismic.io/api/v2 200 in 432ms (cache: MISS)

```

Any suggestions?

---

<div class="post-metadata">

**Author:** ![frags](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/frags/32/5932_2.png) [@frags](https://community.prismic.io/u/frags)\
**Post date:** [May 25, 2023, 6:11am UTC](https://community.prismic.io/t/no-documents-were-returned/13196/2 "2023-05-25T06:11:14Z")

</div>

I think you’re doing what I did [here](https://community.prismic.io/t/prismicnextlink-not-linking-to-document-inside-a-slice-repeatable-field/13147/6)

---

<div class="post-metadata">

**Author:** ![Priyanka](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/priyanka/32/3223_2.png) [@Priyanka](https://community.prismic.io/u/Priyanka)\
**Post date:** [May 25, 2023, 10:10am UTC](https://community.prismic.io/t/no-documents-were-returned/13196/4 "2023-05-25T10:10:06Z")

</div>

Hello @jismonthomas

Welcome to the Prismic community, and thanks for reaching out to us.

Does the solution provided by @frags work for you? I believe the same mistake is here. Let me know if it works for you; otherwise, I'll be happy to troubleshoot the issue.

Thanks,  
Priyanka

---

<div class="post-metadata">

**Author:** ![frags](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/frags/32/5932_2.png) [@frags](https://community.prismic.io/u/frags)\
**Post date:** [May 25, 2023, 10:27am UTC](https://community.prismic.io/t/no-documents-were-returned/13196/5 "2023-05-25T10:27:02Z")

</div>

Yes, it works for me the way I describe in the other thread.

---

<div class="post-metadata">

**Author:** ![jismonthomas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/jismonthomas/32/5961_2.png) [@jismonthomas](https://community.prismic.io/u/jismonthomas)\
**Post date:** [May 25, 2023, 3:25pm UTC](https://community.prismic.io/t/no-documents-were-returned/13196/6 "2023-05-25T15:25:14Z")

</div>

Hi @Priyanka,

unfortunately that did not work for me, now its throwing an error saying module not found.

```auto
./src/app/page.js:1:0
Module not found: Can't resolve '@/prismicio'
> 1 | import { createClient } from '@/prismicio';

```

I only have one page in next js and prismic, not sure what causes this issue.

---

<div class="post-metadata">

**Author:** ![jismonthomas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/jismonthomas/32/5961_2.png) [@jismonthomas](https://community.prismic.io/u/jismonthomas)\
**Post date:** [May 25, 2023, 3:25pm UTC](https://community.prismic.io/t/no-documents-were-returned/13196/7 "2023-05-25T15:25:52Z")

</div>

Thanks for the quick reply @frags, but that did not work for me actually! check my reply below.

---

<div class="post-metadata">

**Author:** ![frags](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/frags/32/5932_2.png) [@frags](https://community.prismic.io/u/frags)\
**Post date:** [May 25, 2023, 3:47pm UTC](https://community.prismic.io/t/no-documents-were-returned/13196/8 "2023-05-25T15:47:27Z")

</div>

Have you installed Slice Machine and done `npx @slicemachine/init@latest` - that's what creates the client in the root of your project.

---

<div class="post-metadata">

**Author:** ![jismonthomas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/jismonthomas/32/5961_2.png) [@jismonthomas](https://community.prismic.io/u/jismonthomas)\
**Post date:** [May 25, 2023, 4:20pm UTC](https://community.prismic.io/t/no-documents-were-returned/13196/9 "2023-05-25T16:20:00Z")

</div>

yes, I have installed the slicemachine and its is running on my local machine!

---

<div class="post-metadata">

**Author:** ![frags](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/frags/32/5932_2.png) [@frags](https://community.prismic.io/u/frags)\
**Post date:** [May 25, 2023, 4:30pm UTC](https://community.prismic.io/t/no-documents-were-returned/13196/10 "2023-05-25T16:30:59Z")

</div>

And you don't have a `prismicio.js|ts` at the route of your project?

---

<div class="post-metadata">

**Author:** ![jismonthomas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/jismonthomas/32/5961_2.png) [@jismonthomas](https://community.prismic.io/u/jismonthomas)\
**Post date:** [May 25, 2023, 4:42pm UTC](https://community.prismic.io/t/no-documents-were-returned/13196/11 "2023-05-25T16:42:38Z")

</div>

Yes, I do have the prosmicio.js file.

This is what I can see in that file, I haven't touched this

```auto
import * as prismic from "@prismicio/client";
import * as prismicNext from "@prismicio/next";
import config from "./slicemachine.config.json";

/**
 * The project's Prismic repository name.
 */
export const repositoryName = config.repositoryName;

/**
 * A list of Route Resolver objects that define how a document's `url` field
 * is resolved.
 *
 * {@link https://prismic.io/docs/route-resolver#route-resolver}
 *
 * @type {prismic.ClientConfig["routes"]}
 */
// TODO: Update the routes array to match your project's route structure.
const routes = [
  {
    type: "homepage",
    path: "/",
  },
  {
    type: "page",
    path: "/:uid",
  },
];

/**
 * Creates a Prismic client for the project's repository. The client is used to
 * query content from the Prismic API.
 *
 * @param {prismicNext.CreateClientConfig} config - Configuration for the Prismic client.
 */
export const createClient = (config = {}) => {
  const client = prismic.createClient(repositoryName, {
    routes,
    ...config,
  });

  prismicNext.enableAutoPreviews({
    client,
    previewData: config.previewData,
    req: config.req,
  });

  return client;
};

```

---

<div class="post-metadata">

**Author:** ![Priyanka](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/priyanka/32/3223_2.png) [@Priyanka](https://community.prismic.io/u/Priyanka)\
**Post date:** [May 26, 2023, 8:57am UTC](https://community.prismic.io/t/no-documents-were-returned/13196/12 "2023-05-26T08:57:21Z")

</div>

Hello @jismonthomas

Looking at your [prismic.io](http://prismic.io) js file, it seems you haven't updated the `routes` array to match your project's route structure. Can you share the repo name and the folder structure of the project?

Thanks,  
Priyanka

---

<div class="post-metadata">

**Author:** ![Priyanka](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/priyanka/32/3223_2.png) [@Priyanka](https://community.prismic.io/u/Priyanka)\
**Post date:** [May 30, 2023, 9:46am UTC](https://community.prismic.io/t/no-documents-were-returned/13196/15 "2023-05-30T09:46:08Z")

</div>

Hello @jismonthomas

I have checked your project files and found multiple issues that you need to fix.

1. To import `prismicio` in the about/page.js: file, the path should be:  
`import { createClient } from "../../../prismicio"`  
And on the page.js file, the path should be:  
`import { createClient } from "../../prismicio"`

That way, it will remove the **no documents returned error**.

1. Next, you will get another error **Error: [Link resolver error] Unknown type** because your routes option should reflect the folder structure of your Next.js project. You need to correct that one. Please follow the define path article: [Define Paths with Next.js - Documentation - Prismic](https://prismic.io/docs/define-paths-nextjs)

We have the simple starter project in Next js that will be helpful for you.

> **[GitHub - prismicio-community/nextjs-starter-prismic-blog: Blog project with...](https://github.com/prismicio-community/nextjs-starter-prismic-blog)**
>
> Blog project with Next.js & Prismic. Contribute to prismicio-community/nextjs-starter-prismic-blog development by creating an account on GitHub.

Thanks,  
Priyanka

---

<div class="post-metadata">

**Author:** ![jismonthomas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/jismonthomas/32/5961_2.png) [@jismonthomas](https://community.prismic.io/u/jismonthomas)\
**Post date:** [May 30, 2023, 3:29pm UTC](https://community.prismic.io/t/no-documents-were-returned/13196/16 "2023-05-30T15:29:22Z")

</div>

Hi @Priyanka,

That worked like a charm, I did not realize that createClient was imported from 'prismicio.js' file, everything working perfect now. Thanks a lot for your help!.

note: I have deleted the threads with the names to my github & prismic repo.

---

<div class="post-metadata">

**Author:** ![Priyanka](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/priyanka/32/3223_2.png) [@Priyanka](https://community.prismic.io/u/Priyanka)\
**Post date:** [May 31, 2023, 8:08am UTC](https://community.prismic.io/t/no-documents-were-returned/13196/17 "2023-05-31T08:08:10Z")

</div>

@jismonthomas, I am glad that it worked for you. Feel free to reach out to us if you have any further questions.
