-
Notifications
You must be signed in to change notification settings - Fork 100
Gatsby returned unsuccessful Preview status: NO_PAGE_CREATED_FOR_PREVIEWED_NODE #312
Comments
Hi @ardiewen , thank you for opening this issue! This is likely a bug as the new preview logic is brand new (just released last week). In order for me to debug this I'll need an admin account on your WP instance + access to the git repo of the Gatsby frontend. If I set it up myself there's a good chance I'll do things differently than you do and it might not result in the same bug. Thanks! |
Thanks @TylerBarnes, I've sent an wp-admin invite to your email The public repo for the Gatsby side can be accessed here: |
Hi @ardiewen , the reason is that you're only building pages for published posts, so this is the expected behaviour. See this line https://github.com/ardiewen/gatsby-wordpress-preview-minimal/blob/main/gatsby-node.js#L18 You can remove the check for published posts there. In a production site Gatsby will only ever have access to published posts. And in preview mode you want to build pages for unpublished posts. From checking this issue out though I do see there was a regression in the latest version of preview where it no longer acts on |
Thanks @TylerBarnes , that makes total sense, thanks! Perhaps this should be documented as part of the "migrating from other plugins" section. Happy to add a PR if you're accepting them for docs. Were you able to get the preview working by just removing the filter for published posts? I removed it in my minimal repro, ran My local dev environment shows this…
Where it toggles back and forth On the wp-admin side, this is what it looks like for me: I've updated the minimal reproduction public repo with the filters removed. Any thoughts? |
@ardiewen I also updated to all the latest versions of Gatsby, WPGatsby, and the source plugin. Are you on latest when you get that result? ☝️ |
@TylerBarnes hooray! It works. gatsby to 2.28.0 Thanks so much for following up. |
Woo :D glad to hear it! |
@TylerBarnes I have the same problem. Previews show Setup
Id is given through the context and the page appears, without the respective update, on the preview instance. There are no errors in the preview build log… @TylerBarnes any ideas what that might be? @ardiewen updating solved the problem for you? |
@MobyDigg what's your Gatsby Cloud dashboard url? |
@TylerBarnes thanks for the reply. The url is |
I see the same problem in the case where I press preview and the page does not have any uncommitted changes. I have to modify a field for the ActionMonitor to actually start the preview process. |
@TylerBarnes @rburgst I tried to change all kinds of post types / ACF fields etc. without luck. Any ideas what this might be? |
sorry, unfortunately no. For me it works when I change any ACF (I usually pick the topmost one). You can turn on debugging of the preview on gatsby side and run the preview container with |
@rburgst thanks, I did that. I also can see now, that the changes I made appear in the log – so I guess data is transfered properly to Gatsby Cloud. In the end it even says |
@TylerBarnes I found out, that once I hit "Preview Changes" on the WP backend, the preview builds on Gatsby Cloud – but the respective page disappears / turns white on the preview instance. And only that specific one. Once I hit "Update" on the backend to save the post, the page gets rebuild and I can see it again on the preview instance. So somehow the preview button triggers a rebuild, which is buggy. hmmm Also I get
…in the console of the preview page. |
@MobyDigg previews use the build process so that's expected. It sounds like there's a react error happening in your template during previews. If you follow the guide here it should help identify what's going on in your template https://github.com/gatsbyjs/gatsby-source-wordpress-experimental/blob/master/docs/features/preview.md#debugging-previews-in-react. The .js.map 404 shouldn't have any effect |
@TylerBarnes @rburgst I found out what it was: A silly mistake and quite logical, but I didn't think of it first. I hope this might help others, too: In my gatsby-node.js I queried pages/ posts dependent on the status being "published":
…therefore the preview could not find the reworked, unpublished page. Simply deleting the filter, did the trick. Anyways, maybe it would be nice to include one sentence in the docs, which mentions this. |
That one has tripped up a lot of folks! We added it to the docs very recently which is likely why you didn't see it when you were setting up previews initially. Glad to hear it's working for you and apologies this wasn't in the docs earlier. We didn't realize this would be an issue for folks until we started getting reports about it. Hopefully folks in the future will be diverted around this pain 😜 |
Hey @TylerBarnes , I've tried for a few days to get the Preview functionality working in a minimal reproduction environment and can't seem to get it working. I must be interpreting the documentation wrong, as it appears that others seem to have this functionality working.
When I click preview, I get the following error:
Browser Console shows:
I've documented my minimal repro steps below, and can share access to both wp-admin and the modified
gatsby-starter-default
as required.Steps to replicate
Clean Wordpress Enviro
Clean
gatsby-starter-default
When I hit preview, my dev server's logs report:
Any insights would be greatly appreciated. Thanks!
The text was updated successfully, but these errors were encountered: