cms
cms copied to clipboard
Preview Targets are empty upgrading Craft Solo to Craft Pro
Description
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.
Steps to reproduce
- Set up Craft Solo and add any kind of section with a working template.
- Visit a section entry and observe that preview works as expected.
- Upgrade Craft Solo to Craft Pro.
- Revisit the entry from step 2 and observe that preview no longer works.
- Visit that section’s settings and observe that the Preview Targets table has no rows.
Additional info
Craft version: 3.4.10.1
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.2
toCraft 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
- Label: "default"
- URL Format:
{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.2
toCraft 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
- 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.
Any chance this will be fixed anytime soon? Ran into exactly this issue right now and now I am stuck with the tedious task of setting preview targets manually for dozens of single pages (project’s nature requires many singles)
@tsawitzki Unfortunately even if we do get it fixed this very minute, there’s no way the fix could be retroactive, since we don’t know whether the sections that lack any preview targets are intentional or not.
I fully understand that. I managed to fix it manually now but would be great to have it safe in the future as the upgrade from Single to Pro sometimes can only occur later in the Dev process here (after the responsible person was able to obtain/buy the license finally).
Worth mentioning that Craft Pro (and plugins) are free to try indefinitely from non-public environments. So if you know you’re going to be upgrading to it, you can do so at the start of the project regardless of how long it’ll take to buy it.
Oh, wasn't aware of that tbh! Thanks for the insight, Brandon 👍
I just ran into this on a project. I don't use live preview personally, so I was just testing some things out before our client CMS training today.
For me, I believe this happened sometime around 3.6.x (start of build) to 3.7.x (current version – upgraded somewhere between).
I just looked through my history of changes for files in the config/project/sections
folder (in github), but couldn't find where or when this would have happened.
Just to verify, preview targets are set by default to Primary Entry Page
and {url}
by default, correct?
@jsunsawyer no, the issue here is that sections don’t actually have a Preview Targets setting in Craft Solo. They get the equivalent of a {url}
preview target if entries in the sections have URLs, but that is determined automatically when rendering the Edit Entry page, as opposed to something actually getting stored to the project config.
@brandonkelly Ah, I see. Would be cool if these were set up in advance in Craft solo (even if unused), so pro upgrades had section settings ready to go (as if creating a new section in Pro).
Anyway, just knowing that this can happen helps. Thanks for the explanation.
@brandonkelly our studio just encountered this issue today. The project's license (Craft Pro 3.7.38
) wasn't purchased until just before pushing to a staging environment. We manually went through each section to add the corresponding "Primary entry page".
It might also be worth noting that this workflow is pretty common for us. I'm surprised we haven't had this pop up before.
@justenh Why not use Craft Pro as a trial right from the start, if you know you’re going to end up with it?
@brandonkelly Mostly it's just not something we thought about during our last couple of builds (when we noticed this issue). We're also moving fairly quickly and it's just not documented in our process, yet! That said, It was still a bit of a surprise :)
FYI, this issue seems to remain in Craft 4.3.6.1. I don't think we were ever on Solo. If memory serves, we went right to Pro. Maybe not though.
@emarthinsen +1, I can confirm that the issue seems to be present again, ran into it recently with a 4.x Craft instance too.
+1 same here at one 4.x project ...but it was a running project in 4, not while updating from 3 to 4.
Just tested locally on Craft 4 and brand new sections definitely still get their default preview target.
