Cannot publish Custom API - Not recognized in sync
robertraaijmakers opened this issue · 9 comments
Describe the bug
We have created a Custom API and defined in code according to the Custom API Setup. When trying to deploy it with the 5.4.0 version it syncs my plugins, but it doesn't sync the Custom API. Somehow I think it ignores / cannot find the class and then doesn't register it.
I can't find out why it wouldn't recognize the class / doesn't register. I tried to look into to the sync source code, but couldn't find any clue on why it wouldn't register. Maybe some of you know how it internally works and what I might have forgotten. Or is this function disabled at all in the new 3.4.0 version?
Maybe the most important part is that when I register through the plugin registration tool of Microsoft, I do find my custom API, I can register it there, and then (when linking to custom API configuration records) it also executes just fine...
To Reproduce
Steps to reproduce the behavior:
- Add a custom API to your source code
- Try to run the daxif sync script
- Sync script doesn't recognize the Custom API and (when registered through the Plugin Registration tool) it deletes the custom API from the system and when not yet available in the system it doesn't try to register it.
Expected behavior
That the custom API would be registered in through the sync script.
Environment
- D365 Online
- Tool version: 5.4.0
Additional context
(2023-02-07 15:03:08Z) [Info]: DAXIF# v.5.4.0.0
(2023-02-07 15:03:08Z) [Info]: Action: Plugin synchronization
(2023-02-07 15:03:08Z) [Info]: Comparing plugins registered in CRM versus those found in your local code
(2023-02-07 15:03:08Z) [Verbose]: Connection timeout set to 0 hour, 59 minutes, 0 seconds
(2023-02-07 15:03:08Z) [Verbose]: Loading local assembly and it's plugins
(2023-02-07 15:03:08Z) [Verbose]: Local assembly loaded
(2023-02-07 15:03:08Z) [Verbose]: Validating plugins to be registered
(2023-02-07 15:03:08Z) [Verbose]: Validation completed
(2023-02-07 15:03:09Z) [Verbose]: Connection timeout set to 0 hour, 59 minutes, 0 seconds
(2023-02-07 15:03:09Z) [Info]: Starting plugin synchronization
(2023-02-07 15:03:09Z) [Info]: Deleting removed registrations
(2023-02-07 15:03:09Z) [Info]: Creating/updating assembly
(2023-02-07 15:03:10Z) [Info]: Updating pluginassembly: Xxx.Xxx.Dataverse.General.Plugins
(2023-02-07 15:03:10Z) [Info]: Updating existing registrations
(2023-02-07 15:03:10Z) [Info]: Creating new registrations
(2023-02-07 15:03:10Z) [Info]: Plugin synchronization was completed successfully
Unfortunately, CustomAPIs are ONLY synced in the (deprecated) 5.3.1 version - and not in the later versions.
This has been identified as an issue, and will (hopefully) be solved.
Thank you for the quick reply and to bad it is not in the 5.4.0 version (yet). Is there anything I might be able to help out on to speed up the implementation of the sync in 5.4.0?
I tried downgrading to 5.3.1 but that sets me up with some kind of object reference not set to an instance of an object message ...
UPDATE: I downgraded, got error (object ref not set instance of object), removed registration (done with version 5.4.0) from my dev environment, then ran 5.3.1 version again and now it works :) Don't know why, but probably some conflict somewhere between the old and new registration and the matching process? Now my Custom API is registered just fine 🥇
Awesome!
I know @bo-stig-christensen was in a similar situation recently, wanting to utilize functionality from the newer version.
Maybe he has some input as well?
@robertraaijmakers : As @mkholt mentioned, only 5.3.1 contained the CustomAPI support. - The reason for it getting pulled from 5.4.0 was due to the implementation breaking compatibility with existing projects if upgrading Daxif from a previous version.
We are working on getting a new version out with that support back in, but this time without breaking compatibility.
If you are impatient and not afraid of building a local version of Daxif DLLs temporarily then I have created an unofficial temporary branch based off 5.3.1 but having my 2 latest additions as well as the 5.4.0 changes in it (some impersonation fixes).
https://github.com/delegateas/Daxif/tree/5.3.2-CustomAPIs-with-PublishFix
It contains CustomAPI functionality as well as the following:
- Added 'publishAfterSync' parameter to WebResourceSync with default value: 'true'. - This ensures that it is possible to omit PublishAll and explicitly adding such a step in a pipeline afterwards or use a different toolkit for publishing (@bo-stig-christensen)
- Added 'useUniqueInstance' parameter to GetCrmServiceClient() with default value: 'true'. - This enables a single script to correctly connect to multiple environments, while still having the option to set the parameter to 'false' in order to optimize any existing scripts that may be adversely affected regarding performance by this change.
- Fix impersonation in plugin registration (from 5.4.0)
- Add support for resx files (from 5.4.0)
Once we assemble the new version and publish to Nuget you just upgrade as usual.
Using this temporary branch is at your own risk but I am beta-testing it on 2 projects currently and it works (1 project with CustomAPIs and 1 project without).
Thank you! I can confirm this version is working. I did have some issue with upgrading from the previous version (5.3.1) to this one though. Something with "Object reference not set to an instance of an object". It was actually the same message as I got when downgrading from the 5.4.0 version to 5.3.1. So probably some matching has changed and isn't backwards/forwards compatible.
For us not a big dealbreaker as I could simply remove my existing registrations and run the sync script again ;)
@robertraaijmakers : As a quick update I can tell you that we are just finalizing the next release and it should be out later today as a pre-release. - It will mostly be a proper rollup of the branch mentioned above as well as some additional enhancements and compatilibity bugfixes.
I'll be testing that on a few projects later today and hopefully we'll manage to get a final release out today or at least later this week.
Stay tuned...
Thanks, looking forward to the new version! 👍
@robertraaijmakers : Please upgrade to latest version 5.5.1 from yesterday.
It has Custom API support again as well as other enhancements and bugfixes.
Thank you, upgraded on three projects and works like a charm :)