2

I have an unlocked package which deploy succesfully to scratch org or empty dev edition org.

The command is sfdx force:package:install --wait 10 --publishwait 10 --package ${packageName} -k ${packagePassword} -r -u ${sandboxOrgName}

However, if I deploy it to a sandbox org (which contains same meta-data as production), the deploying process will error and complain on some Apex compile failure

Those apex classes are not part of my package, but already exist in the org and compiling issue do exist (such as column missing in the test class, function parameter inconsistence).

It is good to be notified for these issues, but I wonder why unlocked package deployment checks all existing Apex status? Is it possible to passes by so the deployment can go?

2 Answers 2

0

It seems that this is, unfortunately, how it is now. As a walk around, I need to convert to meta-data api and deploy.

There is a thread discussing it: https://success.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F93A000000Lg5U&fId=0D53A00004DOBuf

0

This happens to me as well, but even for classes that are valid and that I can directly re-save in that same org without an issue.

I can't find information anywhere, but it seems like the compiler during package installation might not use the API version specified on the classes, but some other instead.

You can get around this by adding the --apexcompile package flag to your installation command. This will instruct Salesforce to only compile the apex in your package during installation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .