function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eric S ScottEric S Scott 

SFDX Custom Object external sharing access doesn't take with 1st Source:Push

Hello,
When using force:source:push for pushing a custom with <externalSharingModel>Private</externalSharingModel> into a scratch org with "features": [ "Communities", "ExternalSharing", "AuthorApex" ]  it "succeeds".  However the object does not reflect the proper external sharing access.  Thus the ObjectsName__Share object is not available to subsequent APEX classes that may be using.
I've posted a simple example project in bitbucket here that have simple reproduce and work around instructions in the Readme.md.

Has anyone any insights into whether I am missing some critical Meta data / XML?
Thanks.
Eric S ScottEric S Scott
Anyone have any suggestions? I'm still stuck on this and it is stopping my DX adoption for my organization.
thanks,
Eric
Tim BatchelorTim Batchelor
Any update here would be appreciated, this is blocking us from adopting DX.  We were able to create a scratch org and manually enable external sharing model and Private for Account and Contact.  We then use that scratch org for CI and our build is passing.  After setting up the scratch org, here's how we auth'd to it, deployed source and executed tests.
# Decrypt the encrypted key
  - openssl enc -d -aes-256-cbc -in build/server.key.enc -out build/server.key -K $AESKEY -iv $IV
# Authenticate to DevHub
  - sfdx force:auth:jwt:grant --clientid $CONSUMERKEY_HUB --jwtkeyfile build/server.key --username $USERNAME_HUB --setdefaultdevhubusername

# Authenticate to CI Scratch Org
  - sfdx force:auth:jwt:grant --clientid $CONSUMERKEY_HUB --jwtkeyfile build/server.key --username $USERNAME_CI --instanceurl https://test.salesforce.com --setdefaultusername
# Push source to the CI Scratch Org.
  - sfdx force:source:push -f
# Execute the tests and store the results.
  - sfdx force:apex:test:run -r json --wait 30000 > testresults.json

This is great for step 1, however, we can't package b/c one of our dependencies requires an external sharing model on Account. 
Packaging is trying to spin up a new org and install all the dependencies.  
 
$ sfdx force:package:version:create:report -i 08cXXXXXXXXXX
=== Package Version Create Request
NAME                           VALUE
─────────────────────────────  ──────────────────
ID                             08c4A000000XXXXXX
Status                         Error
Package Id                     0Ho4A0000008XXXXX
Package Version Id
Subscriber Package Version Id
Tag
Branch
Created Date                   2018-08-09 10:55
Installation URL
=== Errors
(1) An error occurred while trying to install a package dependency, ID 04t4XXXXXXXaHu: Accounts Missing Organization Feature: Account.Sharing
sfdx-project.json
{
    "packageDirectories": [
        {
            "path": "force-app",
            "default": true,
            "definitionFile": "config/scratch-org-def.json",
            "package": "sfdxRestTransferValidator",
            "versionName": "ver 1.0",
            "versionNumber": "1.0.0.NEXT",
            "dependencies": [
                {
                    "package": "04td00000ABDCDC"
                },
                {
                    "package": "04t0H000000xBDKDKD"
                },
                {
                    "package": "04t0P000000DKDXXXX"
                },
                {
                    "package": "04t4100000XXXXX"
                }
            ]
        },
        {
            "path": "force-app",
            "package": "MY_SFDX",
            "versionName": "ver 0.1",
            "versionNumber": "0.1.0.NEXT",
            "default": false
        }
    ],
    "namespace": "MY_SFDX",
    "sfdcLoginUrl": "https://login.salesforce.com",
    "sourceApiVersion": "43.0",
    "packageAliases": {
        "sfdxRestTransferValidator": "0Ho4A000000XXXXX",
        "LOB_SFDX": "0Ho4A000000CaXXXX"
    }
}