cms icon indicating copy to clipboard operation
cms copied to clipboard

Preview Targets are empty upgrading Craft Solo to Craft Pro

Open mattstein opened this issue 4 years ago • 22 comments

Description

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

empty-preview-targets

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

  1. Set up Craft Solo and add any kind of section with a working template.
  2. Visit a section entry and observe that preview works as expected.
  3. Upgrade Craft Solo to Craft Pro.
  4. Revisit the entry from step 2 and observe that preview no longer works.
  5. Visit that section’s settings and observe that the Preview Targets table has no rows.

Additional info

Craft version: 3.4.10.1

mattstein avatar Mar 25 '20 23:03 mattstein

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 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

  • Label: "default"
  • URL Format: {url}

jeromecoupe avatar Mar 29 '20 12:03 jeromecoupe

@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?

brandonkelly avatar Mar 31 '20 10:03 brandonkelly

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.

bencroker avatar Apr 14 '20 11:04 bencroker

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.

bertheyman avatar May 05 '20 07:05 bertheyman

Same problem here. All Preview Targets missing.

davidhellmann avatar Jul 03 '20 23:07 davidhellmann

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?

jishi avatar Sep 17 '20 12:09 jishi

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 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

  • Label: "default"
  • URL Format: {url}

bertheyman avatar Sep 17 '20 13:09 bertheyman

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 avatar Sep 17 '20 13:09 jishi

@jishi The behavior changed in 3.4.0 (see https://github.com/craftcms/cms/issues/4520#issuecomment-531040417).

brandonkelly avatar Sep 18 '20 00:09 brandonkelly

Hi, looks like this is back. A new system with 3.5.16 running, Pro Version, Redactor, Seomatic ... and preview targets are empty

DavidKabelitz avatar Dec 01 '20 17:12 DavidKabelitz

The “bug” never went away. You will need to add your preview target(s) manually after upgrading to Craft Pro.

brandonkelly avatar Dec 01 '20 22:12 brandonkelly

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 avatar Jun 01 '21 13:06 tsawitzki

@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.

brandonkelly avatar Jun 01 '21 17:06 brandonkelly

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).

tsawitzki avatar Jun 01 '21 18:06 tsawitzki

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.

brandonkelly avatar Jun 01 '21 18:06 brandonkelly

Oh, wasn't aware of that tbh! Thanks for the insight, Brandon 👍

tsawitzki avatar Jun 02 '21 10:06 tsawitzki

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 avatar Jul 28 '21 16:07 jsunsawyer

@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 avatar Jul 28 '21 22:07 brandonkelly

@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.

jsunsawyer avatar Jul 28 '21 22:07 jsunsawyer

@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 avatar Apr 21 '22 20:04 justenh

@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 avatar Apr 22 '22 12:04 brandonkelly

@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 :)

justenh avatar Apr 22 '22 14:04 justenh

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 avatar Jan 24 '23 23:01 emarthinsen

@emarthinsen +1, I can confirm that the issue seems to be present again, ran into it recently with a 4.x Craft instance too.

tsawitzki avatar Jan 25 '23 10:01 tsawitzki

+1 same here at one 4.x project ...but it was a running project in 4, not while updating from 3 to 4.

DavidKabelitz avatar Jan 25 '23 10:01 DavidKabelitz

Just tested locally on Craft 4 and brand new sections definitely still get their default preview target.

the Preview Targets setting for a brand new section

brandonkelly avatar Feb 02 '23 23:02 brandonkelly