Hello there!
Since I have switched my dynamic pages to getServerSideProps I have a 403 error on all my dynamic pages [uid] in the console, but they can still be displayed in the front:
example /page/[uid]:
import React from "react";
import Head from "next/head";
import { SliceZone } from "@prismicio/react";
import * as prismicH from "@prismicio/helpers";
import { createClient } from "../prismicio";
import { components } from "../slices";
const Page = ({ page, navigation, settings }) => {
return <SliceZone slices={page.data.slices} components={components} />;
};
export default Page;
export async function getServerSideProps({ params, previewData }) {
const client = createClient({ previewData });
const page = await client.getByUID("pillar_page", params.uid);
return {
props: {
page,
},
};
}
The error :
error - PrismicError: No documents were returned
at Client.getFirst (file:///Users/marving/code/data-jobs/node_modules/@prismicio/client/dist/index.js:328:11)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Client.getByUID (file:///Users/marving/code/data-jobs/node_modules/@prismicio/client/dist/index.js:368:12)
at async getServerSideProps (webpack-internal:///./pages/[uid].js:54:18)
at async Object.renderToHTML (/Users/marving/code/data-jobs/node_modules/next/dist/server/render.js:508:20)
at async doRender (/Users/marving/code/data-jobs/node_modules/next/dist/server/base-server.js:669:38)
at async cacheEntry.responseCache.get.isManualRevalidate.isManualRevalidate (/Users/marving/code/data-jobs/node_modules/next/dist/server/base-server.js:778:28)
at async /Users/marving/code/data-jobs/node_modules/next/dist/server/response-cache/index.js:80:36 {
url: 'https://dataaijobs.prismic.io/api/v2/documents/search?q=[[at(document.type%2C+"pillar_page")]]&q=[[at(my.pillar_page.uid%2C+"robots.txt")]]&pageSize=1&ref=Y2MxCREAAF5wK0QN&routes=[{"type"%3A"blog_homepage"%2C"path"%3A"%2Fblog"}%2C{"type"%3A"blog_post"%2C"path"%3A"%2Fblog%2F%3Auid"}%2C{"type"%3A"pillar_page"%2C"path"%3A"%2F%3Auid"}]',
response: undefined,
page: '/[uid]'