6

I'm trying to create a package version to an unlocked package I've created and keep getting error messages.

The first problem I've encountered was a long error message about invalid type and variables that does not exists:

ERROR running force:package:version:create:  

User_TriggerHandler: Invalid type: Schema.Menora_Metadata_Setting__mdt,
User_TriggerHandler: Variable does not exist: openIncidentsByStaffId,
User_TriggerHandler: Variable does not exist: openIncidentsByStaffId,
User_TriggerHandler: Invalid type: BMCServiceDesk__Incident__c,
User_TriggerHandler: Variable does not exist: openIncidentsByStaffId,
User_TriggerHandler: Invalid type: BMCServiceDesk__Incident__c,
TRG_User_AfterUpdate: Variable does not exist: MNR_Action_AccountLink__c,
User_Tests: Field does not exist: BMCServiceDesk__IsStaffUser__c on User,
User_Tests: Field does not exist: MNR_OrgUnitName__c on User,
User_Tests: Variable does not exist: incidents,
User_Tests: DML requires SObject or SObject list type: List<BMCServiceDesk__Incident__c>,
User_Tests: Invalid type: BMCServiceDesk__Incident__c,
User_Tests: Invalid type: BMCServiceDesk__Incident__c,
User_Tests: Invalid type: BMCServiceDesk__Incident__c,
User_Tests: Invalid type: BMCServiceDesk__Category__c,
User_Tests: Invalid type: BMCServiceDesk__BMC_BaseElement__c,
User_Tests: Invalid type: BMCServiceDesk__BMC_BaseElement__c,
User_Tests: Invalid type: BMCServiceDesk__Incident__c,
User_Tests: Variable does not exist: incident,
User_Tests: Variable does not exist: incident,
User_Tests: Invalid type: BMCServiceDesk__Incident__c,
User_Tests: Invalid type: BMCServiceDesk__Incident__c,
User_Tests: Variable does not exist: incident,
User_Tests: Variable does not exist: incident,
User_Tests: Invalid type: Schema.Menora_Metadata_Setting__mdt,
User_TriggerHandler: Invalid type: BMCServiceDesk__Incident__c,
User_TriggerHandler: Invalid type: BMCServiceDesk__Incident__c,
User_Tests: Field does not exist: MNR_CustomerCode__c on User,
User_TriggerHandler: Invalid type: Schema.Menora_Metadata_Setting__mdt,
User_TriggerHandler: Invalid type: Schema.Menora_Metadata_Setting__mdt,
User_TriggerHandler: Invalid type: Schema.Menora_Metadata_Setting__mdt,
User_Tests: Initial expression is of incorrect type, expected: SObject but was: Profiles_on_Custom_Hierarchy_Settings__c,
User_Tests: Initial expression is of incorrect type, expected: SObject but was: Incident_Custom_Settings__c,
User_Tests: Initial expression is of incorrect type, expected: SObject but was: BI_Custom_Settings__c,
User_Tests: Initial expression is of incorrect type, expected: SObject but was: QC_Custom_Settings__c,
User_Tests: Initial expression is of incorrect type, expected: SObject but was: Electra_Interface_Settings__c,
User_Tests: Initial expression is of incorrect type, expected: SObject but was: MNR_EnvironmentStaticSettings__c,
User_Tests: Initial expression is of incorrect type, expected: SObject but was: User_Custom_Settings__c,
User_TriggerHandler: Variable does not exist: openIncidentsByStaffId,
User_TriggerHandler: Invalid type: BMCServiceDesk__Incident__c,
User_TriggerHandler: Variable does not exist: incident,User_TriggerHandler: Invalid type: Schema.BMCServiceDesk__Incident__c,
User_Tests: Invalid type: BMCServiceDesk__Category__c,
User_Tests: Invalid type: BMCServiceDesk__BMC_BaseElement__c,
User_Tests: Invalid type: BMCServiceDesk__BMC_BaseElement__c,
RemoveInactiveUsersFromIncidentsStaff: Class RemoveInactiveUsersFromIncidentsStaff must implement the method: void Database.Batchable<SObject>.execute(Database.BatchableContext, List<SObject>),
User_Tests: Invalid type: BMCServiceDesk__Category__c,
User_Tests: Invalid type: BMCServiceDesk__BMC_BaseElement__c,
User_Tests: Invalid type: BMCServiceDesk__BMC_BaseElement__c,
User_Tests: Invalid type: Incident_Custom_Settings__c,
User_Tests: Invalid type: BI_Custom_Settings__c,
User_Tests: Invalid type: QC_Custom_Settings__c,
User_Tests: Invalid type: Electra_Interface_Settings__c,
User_Tests: Invalid type: Profiles_on_Custom_Hierarchy_Settings__c,
User_Tests: Invalid type: Role_to_Profile_Mapping__c,
User_Tests: Invalid type: User_Custom_Settings__c,
User_Tests: Invalid type: MNR_EnvironmentStaticSettings__c,
User_Tests: Initial expression is of incorrect type, expected: SObject but was: Role_to_Profile_Mapping__c

I tried to solve this by adding the managed package dependency to the sfdc-project.json file like this:

{
    "packageDirectories": [
        {
            "path": "force-app",
            "default": true,
            "package": "User",
            "versionName": "Version 1.0",
            "versionNumber": "1.0.0.NEXT",
            "dependencies":[
                {
                    //This didn't work
                    "package": "04t***QAE"

                    //This also didn't work
                    "subscriberPackageVersionId": "04t***QAE"
                }
            ]
        }
    ],
    "namespace": "",
    "sfdcLoginUrl": "https://login.salesforce.com",
    "sourceApiVersion": "47.0",
    "packageAliases": {
        "User": "0Ho***SA0"
    }
}

The problem at this point is that while I don't get the Invalid Type error anymore, the creation of the version is now stuck in the Verifying Dependencies status, no matter how much time I give it:

Request in progress. Sleeping 30 seconds. Will wait a total of 300 more seconds before timing out. Current Status='Initializing'
Request in progress. Sleeping 30 seconds. Will wait a total of 270 more seconds before timing out. Current Status='Verifying dependencies'
Request in progress. Sleeping 30 seconds. Will wait a total of 240 more seconds before timing out. Current Status='Verifying dependencies'
Request in progress. Sleeping 30 seconds. Will wait a total of 210 more seconds before timing out. Current Status='Verifying dependencies'
Request in progress. Sleeping 30 seconds. Will wait a total of 180 more seconds before timing out. Current Status='Verifying dependencies'
Request in progress. Sleeping 30 seconds. Will wait a total of 150 more seconds before timing out. Current Status='Verifying dependencies'
Request in progress. Sleeping 30 seconds. Will wait a total of 120 more seconds before timing out. Current Status='Verifying dependencies'
Request in progress. Sleeping 30 seconds. Will wait a total of 90 more seconds before timing out. Current Status='Verifying dependencies'
Request in progress. Sleeping 30 seconds. Will wait a total of 60 more seconds before timing out. Current Status='Verifying dependencies'
Request in progress. Sleeping 30 seconds. Will wait a total of 30 more seconds before timing out. Current Status='Verifying dependencies'
Package version creation request status is 'Verifying dependencies'. Run "sfdx force:package:version:create:report -i 08c5J0000008ORCQA2" to query for status.

Running the report command provides the following details:

=== Package Version Create Request
NAME                           VALUE
─────────────────────────────  ──────────────────────
ID                             08c***QA2
Status                         Verifying dependencies
Package Id                     0Ho***SA0
Package Version Id
Subscriber Package Version Id
Tag
Branch
Created Date                   2020-01-22 16:46
Installation URL

I've read this answer and this but applying the suggestions given there didn't help. I'm at lost.

Update
After setting the --wait flag to 60 minutes I got the following results:

..
...
Request in progress. Sleeping 30 seconds. Will wait a total of 1500 more seconds before timing out. Current Status='Verifying dependencies'
Request in progress. Sleeping 30 seconds. Will wait a total of 1470 more seconds before timing out. Current Status='Verifying dependencies'
Request in progress. Sleeping 30 seconds. Will wait a total of 1440 more seconds before timing out. Current Status='Verifying dependencies'
Request in progress. Sleeping 30 seconds. Will wait a total of 1410 more seconds before timing out. Current Status='Verifying dependencies'
Request in progress. Sleeping 30 seconds. Will wait a total of 1380 more seconds before timing out. Current Status='Verifying dependencies'
Request in progress. Sleeping 30 seconds. Will wait a total of 1350 more seconds before timing out. Current Status='Verifying dependencies'
Request in progress. Sleeping 30 seconds. Will wait a total of 1320 more seconds before timing out. Current Status='Verifying dependencies'
Request in progress. Sleeping 30 seconds. Will wait a total of 1290 more seconds before timing out. Current Status='Verifying metadata'
ERROR running force:package:version:create:  
RemoveInactiveUsersFromIncidentsStaff: Class RemoveInactiveUsersFromIncidentsStaff must implement the method: void Database.Batchable<SObject>.execute(Database.BatchableContext,List<SObject>),
User_Tests: Invalid type: BMCServiceDesk__Category__c,
User_Tests: Invalid type: BMCServiceDesk__Category__c,
User_Tests: Invalid type: BMCServiceDesk__BMC_BaseElement__c,
User_Tests: Invalid type: BMCServiceDesk__BMC_BaseElement__c,
User_Tests: Invalid type: BMCServiceDesk__BMC_BaseElement__c,
User_Tests: Invalid type: BMCServiceDesk__BMC_BaseElement__c,
User_Tests: Invalid type: Incident_Custom_Settings__c,
User_Tests: Invalid type: BI_Custom_Settings__c,
User_Tests: Invalid type: QC_Custom_Settings__c,
User_Tests: Invalid type: Electra_Interface_Settings__c,
User_Tests: Invalid type: Profiles_on_Custom_Hierarchy_Settings__c,
User_Tests: Invalid type: Role_to_Profile_Mapping__c,
User_Tests: Invalid type: User_Custom_Settings__c,
User_Tests: Invalid type: MNR_EnvironmentStaticSettings__c,
User_Tests: Initial expression is of incorrect type, expected: SObject but was: Role_to_Profile_Mapping__c,
User_Tests: Initial expression is of incorrect type, expected: SObject but was: Profiles_on_Custom_Hierarchy_Settings__c,
User_Tests: Initial expression is of incorrect type, expected: SObject but was: Incident_Custom_Settings__c,
User_Tests: Initial expression is of incorrect type, expected: SObject but was: BI_Custom_Settings__c,
User_Tests: Initial expression is of incorrect type, expected: SObject but was: QC_Custom_Settings__c,
User_Tests: Initial expression is of incorrect type, expected: SObject but was: Electra_Interface_Settings__c,
User_Tests: Initial expression is of incorrect type, expected: SObject but was: MNR_EnvironmentStaticSettings__c,
User_Tests: Initial expression is of incorrect type, expected: SObject but was: User_Custom_Settings__c,
User_Tests: Field does not exist: MNR_CustomerCode__c on User,
User_Tests: Field does not exist: MNR_OrgUnitName__c on User,
User_Tests: Invalid type: BMCServiceDesk__Incident__c,
User_Tests: Invalid type: BMCServiceDesk__Category__c,
User_Tests: Invalid type: BMCServiceDesk__BMC_BaseElement__c,
User_Tests: Invalid type: BMCServiceDesk__BMC_BaseElement__c,
User_Tests: Invalid type: BMCServiceDesk__Incident__c,User_Tests: Variable does not exist: incidents,
User_Tests: DML requires SObject or SObject list type: List<BMCServiceDesk__Incident__c>,
User_Tests: Invalid type: BMCServiceDesk__Incident__c,
User_Tests: Invalid type: BMCServiceDesk__Incident__c,
User_Tests: Variable does not exist: incident,
User_Tests: Variable does not exist: incident,
User_Tests: Invalid type: BMCServiceDesk__Incident__c,
User_Tests: Invalid type: BMCServiceDesk__Incident__c,
User_Tests: Variable does not exist: incident,
User_Tests: Variable does not exist: incident,
User_Tests: Invalid type: Schema.Menora_Metadata_Setting__mdt,
User_TriggerHandler: Invalid type: BMCServiceDesk__Incident__c,
User_TriggerHandler: Invalid type: BMCServiceDesk__Incident__c,
User_TriggerHandler: Invalid type: Schema.Menora_Metadata_Setting__mdt,
User_TriggerHandler: Invalid type: Schema.Menora_Metadata_Setting__mdt,
User_TriggerHandler: Invalid type: Schema.Menora_Metadata_Setting__mdt,
User_TriggerHandler: Invalid type: Schema.Menora_Metadata_Setting__mdt,
User_TriggerHandler: Variable does not exist: openIncidentsByStaffId,
User_TriggerHandler: Variable does not exist: openIncidentsByStaffId,
User_TriggerHandler: Invalid type: BMCServiceDesk__Incident__c,
User_TriggerHandler: Variable does not exist: openIncidentsByStaffId,
User_TriggerHandler: Invalid type: BMCServiceDesk__Incident__c,
User_TriggerHandler: Invalid type: Schema.BMCServiceDesk__Incident__c,
User_TriggerHandler: Invalid type: BMCServiceDesk__Incident__c,
User_TriggerHandler: Variable does not exist: openIncidentsByStaffId,
User_TriggerHandler: Variable does not exist: incident,
TRG_User_AfterUpdate: Variable does not exist: MNR_Action_AccountLink__c

So now the status is Verifying Metadata, but the version creation is still failing.

Thank you all in advance,
Lior.

3

In the following document youll find some common scenarios which might help - https://sfdc-db-gmail.github.io/unlocked-packages/faq-unlocked-pkgs.html#specify-pkg-dep

When declaring dependencies you should match between your package aliases.

"dependencies": [
                {
                    "package": "yourManagedPackageAlias"
                },
               ... ],
    ... ],
"packageAliases": {
        "yourManagedPackageAlias":  "04tXX...",
  • Hi sfdx bomb, I tried it with no success. It's still stuck in Verifying Dependencies status. – Lior Lavi Jan 22 at 16:34
  • 2
    when managed package installation takes too long it might be a timeout issue - try to increase the --wait flag to max. Maybe wait and check for status later with sfdx force:package:version:create:list --createdlastdays 7 get the RequestId and sfdx force:package:version:create:report --packagecreaterequestid to investigate any errors. – sfdx bomb Jan 22 at 16:41
  • Hi sfdx bomb, please see my update in the question after increasing the --wait flag. – Lior Lavi Jan 22 at 21:38
  • @LiorLavi I double-checked my config at work, and this is definitely correct. You may need to wait a long while--I have my "wait" time set to 100 minutes, and it usually takes at least 45-50 (but I also have 5 or so dependent packages). – sfdcfox Jan 22 at 22:07
  • Hi @sfdxbomb, the error still appears. Could it be related to the fact that when I'm creating a scratch org from my DevHub it is created without the metadata, custom fields and managed packages installed in the DevHub? I thought the the whole idea with scratch org is that it is identical to the DevHub from which it is created so you can develop against it. – Lior Lavi Jan 23 at 9:43
0

My first attempt at helping out here in SE

"Could it be related to the fact that when I'm creating a scratch org from my DevHub it is created without the metadata, custom fields and managed packages installed in the DevHub? I thought the the whole idea with scratch org is that it is identical to the DevHub from which it is created so you can develop against it"

I don't think that is a correct assumption, Salesforce are looking to provide this functionality by Shaping but it is in pilot.

You need to install managed packages into your scratch manually (or script it)

sfdx force:package:install -p 04txxxxx -w 5 would install the managed package for you after pushing your metadata You then reference the managed package in the dependency.

I am going through this at the moment and will be trying out the various suggestions given.

  • There is no need to install any package on your devhub in order to get it into scratch or to package a new version. – sfdx bomb Mar 4 at 16:13
  • yeah. that is my bad. I meant to say: "You need to install managed packages into your scratch manually (or script it)" – alfo72 Mar 5 at 22:44

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.