So finally we are using some of APEX 20.2 new features like the cool new Data Synchronization for REST Data Sources. I assume most companies deploy from command line so if you do, here are some pointers we have learned from the process and some work arounds for issues that we found.

How to set the remote server/credentials different for for deployments to other environments.

You may have a different endpoint you want to sync for your DEV/TEST/PROD environments. Make sure to go to Edit Remote Server and set "Prompt on Install".

Check off Prompt on Install

Only issue is that this will cause an error when deploying from command line as it is expecting user input to set the remote server on install. To fix this, add the following to your deployment script before calling the app export:

  p_static_id => 'YOUR_SERVER_STATIC_ID', 
  p_base_url => 'https://newbase.url:1234/'

If doing this, you may also have different credentials to set. You can do so by calling the following after you have set your security group and everything, but before installing the app is fine.

apex_credential.set_persistent_credentials (
  p_credential_static_id  => 'CREDENTIAL',
  p_client_id             => 'username',
  p_client_secret         => 'password'

That is all that is needed to have a different set of endpoints and credentials for your environments, without having to manually set them on deployments.

After doing this we noticed that our REST Data Source Synchronization was never enabled in our new environments. The synchronization schedule was there, but the log was gone, and it was not syncing after our deployments. I feel like this is a bug and maybe it is fixed in 21.1, but I have not tested there yet.

How to enable data synchronization after deploying

There are some calls not yet documented in the official API docs for APEX, and we found this to solve the problem. After deploying, you want to make the following call for each of your data sources if you would like the job that syncs in the background to be enabled.

  p_application_id   => 100000,
  p_module_static_id => 'name_of_rest_data_source'

After calling this, you will see it resume its schedule which you had set, and the job will be running.

If you apply all of the above calls to your release, you should be set to not have to manually change anything after your deployments.

Please let me know if anyone else has ran into this. I could not find anything in the docs on this occurring during deployments/imports, and am wondering if it is fixed, or planned to be fixed in future releases. This may be by design, and would like to know why if that is the case.