Views:
Applies to Product – Microsoft Dataverse

What’s happening?
While executing the function app code in Dynamics 365, users encounter an error message indicating that the plug-in execution failed due to the unavailability of hosts. The error message may include details such as "The plug-in execution failed because no [...] Hosts are currently available" and "Error communicating with [...] Host."

Reason:
This may be caused by several factors, including:
- The function app being idle during off-peak hours, leading to slow response times from the Dataverse system.
- Potential network IP restrictions or CORS restrictions applied to the function, disallowing runs from outside the Azure environment.
- A third-party plugin crashing the system sandbox it was running within, which may not have generated a crash dump for analysis.

Resolution:
To resolve this, the following steps can be taken:
1. Run the Function App Manually: Execute the function app manually instead of relying on a timer to gather trace logs and determine if the issue lies within the platform or a plugin execution.
2. Check Plugin Code: If the source code for the third-party plugin is available, review it for potential issues that could lead to crashes. If comfortable, share the code for further analysis.
3. Investigate Data Input: Investigate the data being fed into the plugin to ensure it is valid and consistent across environments. Differences in data ingress between environments could affect performance.
4. Change Trigger Times: Adjust the trigger times for the function app to avoid cold start issues, such as scheduling it to run during peak hours when the system is more active.
5. Upgrade App Service Plan: Consider upgrading the App Service Plan to a premium tier to improve performance and reliability.
If the issue persists after these steps, further investigation may be required, including checking for any stack traces from failed runs in the last 30 days.