When upgrading Craft from Solo to Pro, preview mode stops working everywhere because Preview Targets across all sections are empty:

I’ve been able to manually revisit each section and create a new Preview Target, copying the Section’s URI setting into the Preview Target’s URL Format field.
I would have expected the edition upgrade to automatically set an equivalent Preview Target so that entry previews continue to work without any need for intervention.
Reactivating Solo restores preview functionality.
Craft version: 3.4.10.1
A bit of additional info here if it helps.
Craft Pro 3.1.21.1 + Redactor 2.3.2 to Craft Pro 3.4.11 + Redactor 2.6.1 and the preview buttons were no longer showing up in the CP.I went into he section settings and the Preview Targets table had no row.
Added a row in each Preview Targets table and I was back to normal
{url}@jeromecoupe That sounds like a separate bug. If you have a DB backup from before updating to Craft 3.4, can you please send it over to [email protected], along with your composer.json and composer.lock files?
I can confirm the bug as described by @mattstein. From what I've witnessed, it appears to only happen with channels. The preview targets of singles and structures continue to work as before.
I can confirm too (also started on Solo, upgraded to pro), but also singles and structures were missing previews.
Basically anything that existed before upgrading, new sections after the upgrade are fine and get primary entry page added automatically.
I've two projects on 3.4.4, one is affected and the other isn't: not sure (yet) what exactly is causing this though. Might be related to setup strategy / used migrations or plugins? Unfortunately, no backup from pre-upgrade.
@jeromecoupe Thanks, that's a great fix! Especially since it isn't obvious to find out why the preview is missing if you just upgraded to a version with preview targets.
For people reading here for a solutions: might be wise to use "Primary entry page" as label to be fully consistent with the cms.
Same problem here. All Preview Targets missing.
I'm seeing the same thing in a fresh install if 3.5.9. Looking at another, older install, there are no preview targets defined on the sections on that install but previewing works?
What is the appropriate remedy for this?
I'd suggest having a look at the fix from @jeromecoupe.
As far as I know, preview targets are something new and are not automatically created in every occasion.
So that's why you have to put them there manually in some occasions.
In older versions, the feature does not exist so missing preview targets won't be a problem. (as preview worked in a different way at that point)
A bit of additional info here if it helps.
- Multiple sites and multiple languages install
- Upgraded from
Craft Pro 3.1.21.1 + Redactor 2.3.2toCraft Pro 3.4.11 + Redactor 2.6.1and the preview buttons were no longer showing up in the CP.I went into he section settings and the Preview Targets table had no row.
Added a row in each Preview Targets table and I was back to normal
- Label: "default"
- URL Format:
{url}
That works, but in my other install which runs 3.3.15 it has the preview targets but it's empty and seems to be used for "additional" preview targets... ?
@jishi The behavior changed in 3.4.0 (see https://github.com/craftcms/cms/issues/4520#issuecomment-531040417).
Hi, looks like this is back. A new system with 3.5.16 running, Pro Version, Redactor, Seomatic ... and preview targets are empty
The “bug” never went away. You will need to add your preview target(s) manually after upgrading to Craft Pro.
Most helpful comment
A bit of additional info here if it helps.
Craft Pro 3.1.21.1 + Redactor 2.3.2toCraft Pro 3.4.11 + Redactor 2.6.1and the preview buttons were no longer showing up in the CP.I went into he section settings and the Preview Targets table had no row.
Added a row in each Preview Targets table and I was back to normal
{url}