1

To build DX unlocked packages I am using Bitbucket pipelines. I use the Salesforce configuration template for this.

image: atlassian/default-image:2
pipelines:
  default: #These commands run for all branches unless specified otherwise
    - step:
        script:
          #Assign variables
          - export CLIURL=https://developer.salesforce.com/media/salesforce-cli/sfdx-linux-amd64.tar.xz
          - export SFDX_AUTOUPDATE_DISABLE=false
          - export SFDX_USE_GENERIC_UNIX_KEYCHAIN=true
          - export SFDX_DOMAIN_RETRY=300
          - export SFDX_DISABLE_APP_HUB=true
...
          #Decrypt server key
          - openssl enc -nosalt -aes-256-cbc -d -in assets/server.key.enc -out assets/server.key -base64 -K $DECRYPTION_KEY -iv $DECRYPTION_IV
          #Authorize Dev Hub
          - sfdx force:auth:jwt:grant --clientid $HUB_CONSUMER_KEY --jwtkeyfile assets/server.key --username $HUB_USER_NAME --setdefaultdevhubusername --setalias HubOrg
          #Create scratch org
          - sfdx force:org:create --targetdevhubusername HubOrg --setdefaultusername --definitionfile config/project-scratch-def.json --setalias ciorg --wait 10 --durationdays 1

Strangely scratch org created by the Bitbucket Docker behave differently. I have tests failing because there is no Standard User profile in the scratch orgs.

@IsTest
private class MyClass {

    private static final Id STANDARD_USER = [SELECT Id FROM Profile WHERE Name='Standard User'].Id;

    ...
}

Those tests do NOT fail when the scratch org is created from the command line.

1
  • 1
    I've certainly come across variations in features between scratch orgs created from a single dev hub with an unchanging scratch def, there's a number of posts like that in the DX group on success. I suspect it's normally dependent on the pod the scratch org ends up on, I've never seen discrepancies between build envs, nor the issue you're having. Have you logged into the scratch org to see if the profile is there? Can you post your scratch definition? We normally run sfdx force:org:open --urlonly within our build script so that we can easily grab a login url to investigate failed builds.
    – James
    Apr 16 '19 at 8:53
1

I found the answer here. My DevHub happens to create a German user and the as described in here https://developer.salesforce.com/forums/?id=906F00000008zDiIAI the Names of Standard Profiles are translated.

I created a follow-up question: Get Standard User Profile Id no matter what the users language is

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.