Cms: Can't install Craft with existing project config, says No primary site exists

Created on 2 Oct 2020  路  5Comments  路  Source: craftcms/cms

Description

Can't install Craft with existing project config, says No primary site exists - while there is. This happens for me on multiple installations - with one and with multiple sites. But it also succeeds on some installations...

...
聽 | > add foreign key userpreferences_userId_fk: {{%userpreferences}} (userId) references {{%users}} (id) ... done (time: 0.002s)
聽 | > add foreign key users_id_fk: {{%users}} (id) references {{%elements}} (id) ... done (time: 0.004s)
聽 | > add foreign key users_photoId_fk: {{%users}} (photoId) references {{%assets}} (id) ... done (time: 0.002s)
聽 | > add foreign key volumefolders_parentId_fk: {{%volumefolders}} (parentId) references {{%volumefolders}} (id) ... done (time: 0.001s)
聽 | > add foreign key volumefolders_volumeId_fk: {{%volumefolders}} (volumeId) references {{%volumes}} (id) ... done (time: 0.002s)
聽 | > add foreign key volumes_fieldLayoutId_fk: {{%volumes}} (fieldLayoutId) references {{%fieldlayouts}} (id) ... done (time: 0.003s)
聽 | > add foreign key widgets_userId_fk: {{%widgets}} (userId) references {{%users}} (id) ... done (time: 0.004s)
聽 | > populating the info table ... done
聽 | > can't apply existing project config: No primary site exists
聽 | > renaming project.yaml to project-2020-10-01-225601.yaml and moving to config backup folder ... done
聽 | > saving default site data ... done
聽 | > saving the first user ... done
聽 | *** installed Craft successfully (time: 3.307s)

Steps to reproduce

  1. Create a multi site environment and save to project config
  2. Try a fresh install with that project config

Additional info

  • Craft version: 3.5.10.1 to 3.5.12
  • PHP version: 7.4.10
  • Database driver & version: PostgreSQL
  • Plugins & versions: -
bug

All 5 comments

Not able to reproduce this on my end. Can you send your Composer and project config files over to [email protected] so we can test with your setup?

@brandonkelly think I found it already - in migrations/Install.php on line 1063 you are calling ProjectConfigHelper::ensureAllSitesProcessed(). At this point Craft::$app->projectConfig->getIsApplyingYamlChanges() is always false, and thus no sites are processed (changed here: https://github.com/craftcms/cms/commit/6f6ba6241f6f6a67ad479f7a84a5659fb7c55581#diff-100ad843bc151c8d7358da24c6c30545)

Alright, probably just fixed it. Can you update to dev-develop and see if that works for you?

@brandonkelly thanks, that fixed it :-)

Craft 3.5.13 is out now with that fix.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

angrybrad picture angrybrad  路  3Comments

Mosnar picture Mosnar  路  3Comments

michaelhue picture michaelhue  路  3Comments

angrybrad picture angrybrad  路  3Comments

davist11 picture davist11  路  3Comments