sfpowerkit icon indicating copy to clipboard operation
sfpowerkit copied to clipboard

sfpowerkit:pool:create fails IP Relaxation

Open jverelst opened this issue 2 years ago • 4 comments

Describe the bug Our Azure pipeline that fills our pool at a nightly interval now fails with the following exception:

sf:INVALID_CROSS_REFERENCE_KEY: INVALID_CROSS_REFERENCE_KEY: invalid cross reference id
    at module.exports.HttpApi.getError (/sfdx/node_modules/jsforce/lib/http-api.js:250:13)
    at /sfdx/node_modules/jsforce/lib/http-api.js:95:22
    at tryCallOne (/sfdx/node_modules/promise/lib/core.js:37:12)
    at /sfdx/node_modules/promise/lib/core.js:123:15
    at flush (/sfdx/node_modules/asap/raw.js:50:29)
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  errorCode: 'sf:INVALID_CROSS_REFERENCE_KEY'
}

This appears to happen during the 'Relax IP ranges' step, that we configured in our json/

In the stacktrace I see the following data being posted that gives this 500 error:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header xmlns="http://soap.sforce.com/2006/04/metadata">
<SessionHeader><sessionId>00D1j000000GMvO!AQoAQOq20[redacted]</sessionId></SessionHeader>
<CallOptions><client>sfdx toolbelt:</client></CallOptions>
</soapenv:Header>
<soapenv:Body xmlns="http://soap.sforce.com/2006/04/metadata">
<retrieve>
<request><apiVersion>55.0</apiVersion>
<singlePackage>true</singlePackage>
<unpackaged>
<types>
  <name>Settings</name>
  <members>Security</members>
</types>
</unpackaged>
</request>
</retrieve>
</soapenv:Body>
</soapenv:Envelope>

To Reproduce Steps to reproduce the behavior:

sfdx sfpowerkit:pool:create -f config/pool-config-full.json -v DEVHUB

Contents of the config/pool-config-full.json:

{
    "pool": {
      "expiry": 30,
      "config_file_path": "config/enterprise-scratch-def.json",
      "script_file_path": "scripts/scratch-pool-full-after-create.sh",
      "tag": "full",
      "relax_all_ip_ranges": true,
      "max_allocation": 10
    }
  }

Contents of config/enterprise-scratch-def.json:

{
    "orgName": "Scratch",
    "edition": "Enterprise",
    "features": [
        "AddCustomApps:30",
        "CampaignInfluence2",
        "CaseClassification",
        "ChatterAnswers",
        "Communities",
        "ContactsToMultipleAccounts",
        "CPQ",
        "CustomerCommunity",
        "CustomerCommunityLogin",
        "CustomerCommunityPlus",
        "CustomerCommunityPlusLogin",
        "DeferSharingCalc",
        "ExternalIdentityLogin",
        "FieldAuditTrail",
        "ForceComPlatform",
        "Knowledge",
        "LiveAgent",
        "LightningSalesConsole",
        "LightningServiceConsole",
        "PartnerCommunity",
        "PersonAccounts",
        "ProductsAndSchedules",
        "SalesforceContentUser",
        "SharedActivities",
        "StateAndCountryPicklist",
        "WorkThanksPref"
    ],
    "language": "en_US",
    "settings": {
        "accountSettings": {
            "enableAccountTeams": true,
            "enableRelateContactToMultipleAccounts": true,
            "enableContactHistoryTracking": true
        },
        "activitiesSettings": {
            "allowUsersToRelateMultipleContactsToTasksAndEvents": true,
            "enableSidebarCalendarShortcut": true
        },
        "apexSettings": {
            "enableApexApprovalLockUnlock": true
        },
        "campaignSettings": {
            "enableCampaignInfluence2": false,
            "enableAccountsAsCM": true
        },
        "chatterSettings": {
            "enableChatter": true
        },
        "communitiesSettings": {
            "enableNetworksEnabled": true,
            "enableCommunityWorkspaces": true,
            "enableOotbProfExtUserOpsEnable": true,
            "enableEnablePRM": true
        },
        "contractSettings": {
            "autoCalculateEndDate": false
        },
        "contentSettings": {
            "enableContent": true
        },
        "emailAdministrationSettings": {
            "enableEnhancedEmailEnabled": true
        },
        "emailTemplateSettings": {
            "enableTemplateEnhancedFolderPref": true
        },
        "forecastingSettings": {
            "enableForecasts": false
        },
        "ideasSettings": {
            "enableIdeas": true
        },
        "knowledgeSettings": {
            "enableKnowledge": true,
            "enableLightningKnowledge": true,
            "defaultLanguage": "nl_NL",
            "showValidationStatusField": false,
            "showArticleSummariesInternalApp": true,
            "showArticleSummariesCustomerPortal": false,
            "showArticleSummariesPartnerPortal": false,
            "languages": {
                "language": [
                    {
                        "name": "en_US",
                        "active": true
                    },
                    {
                        "name": "nl_NL",
                        "active": true
                    },
                    {
                        "name": "fr",
                        "active": true
                    }
                ]
            }
        },
        "languageSettings": {
            "enableTranslationWorkbench": true
        },
        "lightningExperienceSettings": {
            "enableS1DesktopEnabled": true
        },
        "liveAgentSettings": {
            "enableLiveAgent": true
        },
        "omniChannelSettings": {
            "enableOmniChannel": true
        },
        "opportunitySettings": {
            "enableOpportunityFieldHistoryTracking": true,
            "enableOpportunityTeam": true
        },
        "orderSettings": {
            "enableOrders": true
        },
        "productSettings": {
            "enableRevenueSchedule": true
        },
        "quoteSettings": {
            "enableQuote": true
        },
        "enhancedNotesSettings": {
            "enableEnhancedNotes": true
        },
        "securitySettings": {
            "enableAuditFieldsInactiveOwner": true
        },
        "userInterfaceSettings": {
            "enableAsyncRelatedLists": true
        },
        "workDotComSettings": {
            "enableWorkThanksPref": true,
            "enableProfileSkills": false
        }
    }
}


Environment

{
  "cliVersion": "sfdx-cli/7.166.1",
  "architecture": "linux-x64",
  "nodeVersion": "node-v16.13.1",
  "pluginVersions": [
    "@jayree/sfdx-plugin-legacy 1.0.2 (user)",
    "@jayree/sfdx-plugin-manifest 2.2.10 (user)",
    "@jayree/sfdx-plugin-prettier 1.1.7 (user)",
    "@oclif/plugin-autocomplete 1.3.0 (core)",
    "@oclif/plugin-commands 2.2.0 (core)",
    "@oclif/plugin-help 2.2.3 (user)",
    "@oclif/plugin-not-found 2.3.1 (core)",
    "@oclif/plugin-plugins 2.1.0 (core)",
    "@oclif/plugin-update 3.0.0 (core)",
    "@oclif/plugin-version 1.1.2 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.4 (core)",
    "@oclif/plugin-which 2.1.0 (core)",
    "alias 2.1.0 (core)",
    "apex 1.2.0 (core)",
    "auth 2.2.3 (core)",
    "community 2.0.1 (core)",
    "config 1.4.17 (core)",
    "custom-metadata 2.0.0 (core)",
    "data 2.1.2 (core)",
    "generator 2.0.2 (core)",
    "info 2.0.1 (core)",
    "limits 2.0.1 (core)",
    "org 2.2.0 (core)",
    "packaging 1.5.1 (core)",
    "schema 2.1.1 (core)",
    "signups 1.2.0 (core)",
    "source 2.0.13 (core)",
    "telemetry 2.0.0 (core)",
    "templates 55.1.0 (core)",
    "trust 2.0.3 (core)",
    "user 2.1.0 (core)",
    "@salesforce/sfdx-plugin-lwc-test 1.0.0 (core)",
    "dxb 1.7.12 (user)",
    "salesforce-alm 54.8.1 (core)",
    "sfdmu 4.15.1 (user)",
    "sfdx-browserforce-plugin 2.9.1 (user)",
    "sfdx-jayree 4.3.18 (user)",
    "sfpowerkit 5.0.0 (user)",
    "texei-sfdx-plugin 1.16.5 (user)"
  ],
  "osVersion": "Linux 5.15.0-1017-azure",
  "shell": "bash",
  "rootPath": "/usr/local/lib/nodejs/lib/node_modules/sfdx-cli"
}

Additional context I am unable to reproduce the exception when manually doing a force:mdapi:retrieve or a force:source:retrieve.

jverelst avatar Sep 12 '22 06:09 jverelst

@jverelst have you made any changes to your config recently? I'll see if I can reproduce this.

Caitlyn-Mills avatar Sep 12 '22 06:09 Caitlyn-Mills

Not to the config, but we did upgrade the SFDX version recently, which might have introduced this. For as far as I can see in our buildlogs:

  • 7.158.0 => gives this error
  • 7.166.0 => gives this error
  • 7.163.0 => no error

If this plugin relies on SFDX, then maybe a change under the hood there is the cause of this.

jverelst avatar Sep 12 '22 07:09 jverelst

Ok thanks for that extra info. I recommend going back down to 163.0 until we can look into this.

Caitlyn-Mills avatar Sep 12 '22 07:09 Caitlyn-Mills

@Caitlyn-Mills unfortunately the pipeline is now also failing with 163.0; which is kind of weird because we haven't changed anything in the docker image. Maybe the SFDX version wasn't the root cause, and we were just lucky that the pipeline did run succesfully a few times.

Any news on this issue? Or any suggestions on things we could try to mitigate this?

jverelst avatar Sep 30 '22 06:09 jverelst