Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]- SFDMU doesn't play well with @salesforce/cli #634

Closed
nvuillam opened this issue Sep 10, 2023 · 7 comments
Closed

[BUG]- SFDMU doesn't play well with @salesforce/cli #634

nvuillam opened this issue Sep 10, 2023 · 7 comments
Assignees
Labels
completed The issue was successfully resolved/Feature is completed help-wanted User need a help or something not working, not a bug

Comments

@nvuillam
Copy link
Contributor

Describe the bug

sfdmu does not play well with @salesforce/cli, it seems a hook triggers a crash even when sfdmu is not called

To Reproduce

Github Action workflow crashing with sfdmu with hte following error

2023-09-10T16:06:17.674Z sf:sfdx-hardis:hooks:init TypeError: Cannot read properties of undefined (reading 'prototype')
    at Object.<anonymous> (/home/runner/.local/share/sf/node_modules/sfdx-hardis/node_modules/@salesforce/core/lib/connection.js:28:48)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (/home/runner/.local/share/sf/node_modules/sfdx-hardis/node_modules/@salesforce/core/lib/authInfo.js:25:22)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
# Add your major branches names here
# If you do, also add SFDX_CLIENT_ID / KEY variables in job step "Login & Process Deployment" below
on:
  push:
    branches:
      - main
      - preprod
      - uat
      - integration

name: Process Deployment (sfdx-hardis)

concurrency:
  group: ${{ github.ref }}-${{ github.workflow }}
  cancel-in-progress: true

jobs:
  process_deployment:
    name: Process Deployment to Major Org
    runs-on: ubuntu-latest
    steps:
    # Checkout repo
    - name: Checkout code
      uses: actions/checkout@v4
      with:
        fetch-depth: 0 # Faster code checkout fetching only latest commit
    # Setup node
    - name: Setup Node
      uses: actions/setup-node@v3
      with:
        node-version: "18"
    # SFDX & plugins
    - name: Install SFDX and plugins
      run: |
        npm install @salesforce/cli --global
        sf plugins install @salesforce/plugin-packaging
        echo 'y' | sfdx plugins:install sfdx-hardis
        echo 'y' | sfdx plugins:install sfdx-essentials
        echo 'y' | sfdx plugins:install sfdmu # Disabled while it does not play well with @salesforce/cli
        echo 'y' | sfdx plugins:install sfdx-git-delta
        sf version --verbose --json
    # Set env branch variable (github.ref_name seems to not work)
    - name: Set env.BRANCH
      run: echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV
    # Login & check deploy with test classes & code coverage
    - name: Login & Process Deployment
      env:
        SFDX_CLIENT_ID_INTEGRATION: ${{ secrets.SFDX_CLIENT_ID_INTEGRATION}}
        SFDX_CLIENT_KEY_INTEGRATION: ${{ secrets.SFDX_CLIENT_KEY_INTEGRATION}}
        SFDX_CLIENT_ID_UAT: ${{ secrets.SFDX_CLIENT_ID_UAT}}
        SFDX_CLIENT_KEY_UAT: ${{ secrets.SFDX_CLIENT_KEY_UAT}}
        SFDX_CLIENT_ID_PREPROD: ${{ secrets.SFDX_CLIENT_ID_PREPROD}}
        SFDX_CLIENT_KEY_PREPROD: ${{ secrets.SFDX_CLIENT_KEY_PREPROD}}
        SFDX_CLIENT_ID_MAIN: ${{ secrets.SFDX_CLIENT_ID_MAIN}}
        SFDX_CLIENT_KEY_MAIN: ${{ secrets.SFDX_CLIENT_KEY_MAIN}}
        SFDX_DEPLOY_WAIT_MINUTES: 120 # Override if necessary
        SFDX_TEST_WAIT_MINUTES: 120 # Override if necessary
        CI_COMMIT_REF_NAME: ${{ env.BRANCH }} # Defines the target branch of the PR
        ORG_ALIAS: ${{ env.BRANCH }} # Defines the target branch of the PR
        CONFIG_BRANCH: ${{ env.BRANCH }} # Defines the target branch of the PR
        FORCE_COLOR: "1"
      run: |
        echo "Process SFDX deployment using Hardis against \"$CONFIG_BRANCH\""
        sfdx hardis:auth:login
        sfdx hardis:project:deploy:sources:dx

Github Workflow not crashing without sfdmu

# Add your major branches names here
# If you do, also add SFDX_CLIENT_ID / KEY variables in job step "Login & Process Deployment" below
on:
  push:
    branches:
      - main
      - preprod
      - uat
      - integration

name: Process Deployment (sfdx-hardis)

concurrency:
  group: ${{ github.ref }}-${{ github.workflow }}
  cancel-in-progress: true

jobs:
  process_deployment:
    name: Process Deployment to Major Org
    runs-on: ubuntu-latest
    steps:
    # Checkout repo
    - name: Checkout code
      uses: actions/checkout@v4
      with:
        fetch-depth: 0 # Faster code checkout fetching only latest commit
    # Setup node
    - name: Setup Node
      uses: actions/setup-node@v3
      with:
        node-version: "18"
    # SFDX & plugins
    - name: Install SFDX and plugins
      run: |
        npm install @salesforce/cli --global
        sf plugins install @salesforce/plugin-packaging
        echo 'y' | sfdx plugins:install sfdx-hardis
        echo 'y' | sfdx plugins:install sfdx-essentials
        # echo 'y' | sfdx plugins:install sfdmu # Disabled while it does not play well with @salesforce/cli
        echo 'y' | sfdx plugins:install sfdx-git-delta
        sf version --verbose --json
    # Set env branch variable (github.ref_name seems to not work)
    - name: Set env.BRANCH
      run: echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV
    # Login & check deploy with test classes & code coverage
    - name: Login & Process Deployment
      env:
        SFDX_CLIENT_ID_INTEGRATION: ${{ secrets.SFDX_CLIENT_ID_INTEGRATION}}
        SFDX_CLIENT_KEY_INTEGRATION: ${{ secrets.SFDX_CLIENT_KEY_INTEGRATION}}
        SFDX_CLIENT_ID_UAT: ${{ secrets.SFDX_CLIENT_ID_UAT}}
        SFDX_CLIENT_KEY_UAT: ${{ secrets.SFDX_CLIENT_KEY_UAT}}
        SFDX_CLIENT_ID_PREPROD: ${{ secrets.SFDX_CLIENT_ID_PREPROD}}
        SFDX_CLIENT_KEY_PREPROD: ${{ secrets.SFDX_CLIENT_KEY_PREPROD}}
        SFDX_CLIENT_ID_MAIN: ${{ secrets.SFDX_CLIENT_ID_MAIN}}
        SFDX_CLIENT_KEY_MAIN: ${{ secrets.SFDX_CLIENT_KEY_MAIN}}
        SFDX_DEPLOY_WAIT_MINUTES: 120 # Override if necessary
        SFDX_TEST_WAIT_MINUTES: 120 # Override if necessary
        CI_COMMIT_REF_NAME: ${{ env.BRANCH }} # Defines the target branch of the PR
        ORG_ALIAS: ${{ env.BRANCH }} # Defines the target branch of the PR
        CONFIG_BRANCH: ${{ env.BRANCH }} # Defines the target branch of the PR
        FORCE_COLOR: "1"
      run: |
        echo "Process SFDX deployment using Hardis against \"$CONFIG_BRANCH\""
        sfdx hardis:auth:login
        sfdx hardis:project:deploy:sources:dx

Expected behavior

No crash ^^

export.json

Unapplicable

Log file

with sfdmu installed -> https://github.com/nvuillam/demo-salesforce-ci/actions/runs/6138154545/job/16654755656
without sfdmu installed -> https://github.com/nvuillam/demo-salesforce-ci/actions/runs/6138398746/job/16655256589

_target.csv file.

Not applicable

@nvuillam nvuillam added the bug Something isn't working, looks like a bug label Sep 10, 2023
@hknokh2
Copy link
Contributor

hknokh2 commented Sep 10, 2023

Greetings!

Unfortunately, I'm not familiar with the GitHub workflow, so I doubt I can assist with this case. I would be grateful if you could figure out why the plugin isn't working in your situation and propose a pull request with an explanation of what's wrong and the corrections made.
The plugin is integrated into your project, and I'm not sure exactly how it operates on your end. Therefore, I believe you'd be in a better position to pinpoint and resolve the issue swiftly.

Thank you a lot!

@nvuillam
Copy link
Contributor Author

nvuillam commented Sep 11, 2023

Do you have anything in sfdmu that is oclif / sfdx hook related ?

I browsed your code base and found nothing... but it must come from something like that, and I'm unable to reproduce the issue locally :(

It is also possible that there is a compatiblity issue with Salesforce CLI ( cc @mshanemc @shetzel just in case )

@hknokh2
Copy link
Contributor

hknokh2 commented Sep 11, 2023

No.
Not using hooks.
Yes. Most possible , it is a new issue with sfdx.

@hknokh hknokh added help-wanted User need a help or something not working, not a bug completed The issue was successfully resolved/Feature is completed and removed bug Something isn't working, looks like a bug labels Sep 13, 2023
@hknokh
Copy link
Collaborator

hknokh commented Sep 13, 2023

Hello.

I hope the issue has been resolved for you. I'm closing it for now. Please let me know if you have any further questions.

Regards.

@hknokh hknokh closed this as completed Sep 13, 2023
@nvuillam
Copy link
Contributor Author

nvuillam commented Sep 18, 2023

@hknokh i've not tried but I presume it is not :/
Maybe we should let this issue open in case someone else experience it ?

By the way, I talked about you at Dreamforce ^^

(low quality video screenshot sorry ^^ )
image

@hknokh2
Copy link
Contributor

hknokh2 commented Sep 18, 2023

Wow! Thank you for sharing the picture!
BTW you are also there )
Regarding the issue. I will try to ask somebody.

@mshanemc
Copy link
Collaborator

huh. @hknokh reached out to me about this. And I have no idea what's happening.

If you've got a simplified reproduction, you can open an item on the main CLI issues repo because this probably needs a debugger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed The issue was successfully resolved/Feature is completed help-wanted User need a help or something not working, not a bug
Projects
None yet
Development

No branches or pull requests

4 participants