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

2GP Package Create Intermittent Failure - Duplicate Rule #3188

Open
Cerelius opened this issue Jan 21, 2025 · 3 comments
Open

2GP Package Create Intermittent Failure - Duplicate Rule #3188

Cerelius opened this issue Jan 21, 2025 · 3 comments
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated

Comments

@Cerelius
Copy link

Cerelius commented Jan 21, 2025

Summary

While trying to create a 2GP package version, the operation will intermittently fail with the error included below. A rerun will typically resolve the issue but I wanted to report this as an issue with 2GP package version creation. I have no recourse for this issue outside of a rerun because the package version creation process is taking place outside of my hands based on the provided source code.

From my perspective, it seems like the phantom org that is creating the package version in the background isn't waiting for the duplicate rule to be applied before attempting to create the package version. Because it's resolved by rerunning it might be some sort of race condition taking place.

"Error": [
          "Before you can use this duplicate rule, all associated matching rules must be active and have their fields mapped."
        ],

The package has a single duplicate rule, seen here.

<?xml version="1.0" encoding="UTF-8"?>
<MatchingRules xmlns="http://soap.sforce.com/2006/04/metadata">
    <matchingRules>
        <fullName>Deployment_User_Duplicate_Rule_matching_rule</fullName>
        <description>Prevent creation of an org registration record that has the same deployment user as another record.</description>
        <label>Deployment User Duplicate Rule matching rule</label>
        <matchingRuleItems>
            <blankValueBehavior>NullNotAllowed</blankValueBehavior>
            <fieldName>PackageManager__Deployment_User__c</fieldName>
            <matchingMethod>Exact</matchingMethod>
        </matchingRuleItems>
        <ruleStatus>Active</ruleStatus>
    </matchingRules>
</MatchingRules>
Error: {
    "status": 0,
    "result": [
      {
        "Id": "08cPY0000005MBBYA2",
        "Status": "Error",
        "Package2Id": "2GP Package ID",
        "Package2Name": "2GP Package Name",
        "Package2VersionId": null,
        "SubscriberPackageVersionId": null,
        "Tag": null,
        "Branch": null,
        "Error": [
          "Before you can use this duplicate rule, all associated matching rules must be active and have their fields mapped."
        ],
        "CreatedDate": "2025-01-16 21:33",
        "HasMetadataRemoved": null,
        "CodeCoverage": null,
        "VersionNumber": null,
        "HasPassedCodeCoverageCheck": null,
        "CreatedBy": "0051400000CYKKvAAP",
        "ConvertedFromVersionId": "ID Unavailable"
      }
    ],
    "warnings": [
      "(1) Before you can use this duplicate rule, all associated matching rules must be active and have their fields mapped."
    ]
  }

Steps To Reproduce

I'm not able to provide the specific repo that I have seen this issue in but I also don't have a consistent method to recreate this error. It's typically resolved by rerunning the build and doesn't show up on every build. However, I still wanted to raise this as an error in the 2GP package creation process that may be exacerbated by longer application times for more duplicate rules in a package.

- sf package version create --json --skip-ancestor-check --version-number 1.407.0.NEXT --definition-file config/project-scratch-def.json --package PACKAGENAME --installation-key-bypass --code-coverage --version-name ver 1.407.0

Expected result

A new package version has been created.

Actual result

Package version creation fails

System Information

The build is executing on GitHub Actions with @salesforce/cli/2.72.21 node 22

@Cerelius Cerelius added the investigating We're actively investigating this issue label Jan 21, 2025
Copy link

Hello @Cerelius 👋 It looks like you didn't include the full Salesforce CLI version information in your issue.
Please provide the output of version --verbose --json for the CLI you're using (sf or sfdx).

A few more things to check:

  • Make sure you've provided detailed steps to reproduce your issue.
    • A repository that clearly demonstrates the bug is ideal.
  • Make sure you've installed the latest version of Salesforce CLI. (docs)
    • Better yet, try the rc or nightly versions. (docs)
  • Try running the doctor command to diagnose common issues.
  • Search GitHub for existing related issues.

Thank you!

Copy link

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@github-actions github-actions bot added more information required Issue requires more information or a response from the customer and removed investigating We're actively investigating this issue labels Jan 21, 2025
@Cerelius
Copy link
Author

I added a step in the workflow to print out the current version information.

{
  "architecture": "linux-x64",
  "cliVersion": "@salesforce/cli/2.72.21",
  "nodeVersion": "node-v22.12.0",
  "osVersion": "Linux 6.8.0-1017-azure",
  "rootPath": "/opt/hostedtoolcache/node/22.12.0/x64/lib/node_modules/@salesforce/cli",
  "shell": "bash",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.16 (core)",
    "@oclif/plugin-commands 4.1.15 (core)",
    "@oclif/plugin-help 6.2.[20](https://github.com/ncino/force-plm/actions/runs/12896587603/job/35959908612?pr=857#step:7:21) (core)",
    "@oclif/plugin-not-found 3.2.33 (core)",
    "@oclif/plugin-plugins 5.4.24 (core)",
    "@oclif/plugin-search 1.2.17 (core)",
    "@oclif/plugin-update 4.6.[21](https://github.com/ncino/force-plm/actions/runs/12896587603/job/35959908612?pr=857#step:7:22) (core)",
    "@oclif/plugin-version 2.2.19 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.29 (core)",
    "@oclif/plugin-which 3.2.[23](https://github.com/ncino/force-plm/actions/runs/12896587603/job/35959908612?pr=857#step:7:24) (core)",
    "@salesforce/cli 2.72.21 (core)",
    "apex 3.6.8 (core)",
    "api 1.3.2 (core)",
    "auth 3.6.85 (core)",
    "data 4.0.1 (core)",
    "deploy-retrieve 3.17.0 (core)",
    "info 3.4.30 (core)",
    "limits 3.3.43 (core)",
    "marketplace 1.3.7 (core)",
    "org 5.2.16 (core)",
    "packaging 2.9.10 (core)",
    "schema 3.3.45 (core)",
    "settings 2.4.9 (core)",
    "sobject 1.4.48 (core)",
    "telemetry 3.6.[29](https://github.com/ncino/force-plm/actions/runs/12896587603/job/35959908612?pr=857#step:7:30) (core)",
    "templates 56.3.34 (core)",
    "trust 3.7.53 (core)",
    "user 3.6.5 (core)"
  ]
}

@github-actions github-actions bot added investigating We're actively investigating this issue validated Version information for this issue has been validated and removed more information required Issue requires more information or a response from the customer labels Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

1 participant