Closed hazem3500 closed 1 year ago
Hi @hazem3500,
The 404 errors are normal since, when previewing an unpublished document, you will be the 404 page.
Can you confirm a couple of things?
/test
? I'm wondering if the linkResolver
is working correctly.gatsby develop
rather than gatsby build && gatsby server
), do you see a different error?Thanks! 🙂
Hey @angeloashmore 👋
Is the URL correct? Should the unpublished previewed document's URL be /test? I'm wondering if the linkResolver is working correctly.
Yup, the URL should be /test
, was testing out preview XD
The linkResolver
is working with published pages.
If you run this preview in development (i.e. gatsby develop rather than gatsby build && gatsby server), do you see a different error?
I see the Gatsby.js development 404 page, Though when I click the preview 404 page I get to see the page template like expected, but the data
prop passed to the template isn't for the page I'm previewing, It passes the data for the 404 page.
@hazem3500 Do you have <PrismicPreviewProvider>
in both gatsby-browser.js
and gatsby-ssr.js
? If not, can you make sure both have the same wrapRootElement
?
If that does not fix it, could you copy or screenshot the whole console error, including the stack trace? I can't tell where that error is coming from. Thanks!
Oh, while both gatsby-browser
and gatsby-ssr
had PrismicPreviewProvider
, I wasn't passing the repositoryConfigs
to the one in gatsby-ssr
😅
unfortunately, it still didn't fix the issue 😢
When I preview in dev mode, I get an empty page and consoling logging the GraphQL query data of the page template, it gives me the data for the 404 page.
When I preview after build, it gives an error
TypeError: Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
at nonIterableSpread.js:2
at o (toConsumableArray.js:6)
at e.importTypePaths (runtime.ts:229)
at Ii (context.tsx:200)
at Object.ta [as useReducer] (react-dom.production.min.js:157)
at Object.useReducer (react.production.min.js:25)
at Di (context.tsx:348)
at Gi (react-dom.production.min.js:153)
at Ua (react-dom.production.min.js:175)
at xo (react-dom.production.min.js:263)
@angeloashmore any pointers on how to solve this 😅?
@hazem3500 I'll test some things out on my side, but could you share your Prismic repository name with me? It could be something specific to a Custom Type model.
If you want to keep it private, you can send me a message on the Prismic forum here: https://community.prismic.io/new-message?username=angeloashmore&title=GitHub%20Issue%20468
Thanks!
Encountered the same error and resolved switching back to manual schemas.
Currently facing the same issue. Switching to manual schemas had no effect.
This issue is stale and may be fixed in a recent version. Please update to the latest version and try again. If the issue continues to be a problem, please open a new issue. Thank you!
See the documentation for guides on updating to the latest versions: Gatsby + Prismic Migration Guides
I have the latest version of gatsby-source-prismic: 6.0.1
and gatsby-plugin-prismic-previews: 6.0.1
installed and I still get a 404 page when trying to preview unpublished documents. Is there any update on this?
Versions
Steps to reproduce
So I'm trying to preview an unpublished page from Prismic. I'm passing the component resolver to
PrismicPreviewProvider
ingatsby-browser.js
And in the 404 page, I'm wrapping the page with the
withPrismicUnpublishedPreview
HOCBut I'm getting a blank screen
In the console, I'm getting errors like
What is expected?
I should be able to preview unpublished pages
What is actually happening?
I'm getting a blank screen