I have a managed package containing a VF page that uses JSForce to deploy a zipped package of metadata when a user clicks a button. Inside the package I'm trying to deploy is 2 classes and a trigger, and a test class for them.
Like I said, my VF page is part of a managed package. When I install the package into a sandbox or developer org, I am able to successfully click the button on the VF page and deploy the package.
But in production, it doesn't work. The API Call for the deploy comes back with a 500 Server Error.
The important part of my code is here.
var emailTrigger = PackService.getEmailTrigger();
JSForceService.conn.metadata.deploy(emailTrigger, { testLevel: 'RunLocalTests' })
PackService.getEmailTrigger()
returns a base64 encoded zip file, and JSforceService
is a wrapper for the jsforce api.
Is there some kind of block in production orgs which prevents this type of metadata deploy? I found the setting to allow non-certified packages to allow apex metadata deploys and tried that, but it didn't fix anything. Hoping somebody can chime in!