[SalesForce] Using SFDX For CI with Communities, how to activate Community to get Guest UserLicense

I am working on a new implementation of Communities for a project using SFDX. I pulled in the relevant files related to hosting a community but when I do a sfdx force:source:push I get an error on the Community Profile.profile-meta.xml:

"In field: userLicense – no UserLicense named Guest found"

If I go through some manual steps, I can then push the source but I am hoping to use an automated CI to validate tests before installing the package to our dev Org.

Is there any setting to automatically publish the community and give the community Guest User Profile?

Or some way to get around this so I can run our tests in a scratch org in CI before having the CI install the package to our dev org?

Any help would be greatly appreciated, thank you!

Best Answer

Thanks to the hint from Mohith Shrivastava I managed to get rid of this error message by using scratch org definition file with Communites and Sites and Networks enabled:

{
    "orgName": "Demo Company",
    "edition": "Developer",
    "features": ["Communities", "Sites"],
    "settings": {
        "orgPreferenceSettings" : {
            "s1DesktopEnabled": true,
            "networksEnabled": true
        }
    }
}
Related Topic