After creating a Library (
ContentWorkspace
) in a scratch org, the Library is not shown in "My Libraries" and cannot be queried using SOQL.
See gif (newly-created-library-not-visible.gif)
Or create a scratch org and run anonymous apex or/and unit tests:
$ sfdx org create scratch -f config/project-scratch-def.json -a mre-libraries-not-visible -d
$ sfdx apex run -f anonymous-apex-library-test.apex
$ sfdx project deploy start
$ sfdx apex run test -l RunLocalTests -w 10
Failing here means the reproduction was successful
Thankfully the Salesforce Partner Support provided a workaround.
In the config/project-scratch-def.json
file add "hasSampleData": true
.