Forum Discussion
Custom visuals are not rendering due to a CORS error while making an API call
The CORS error occurs when a web application makes a request to a resource on a different domain or port. In this case, the API endpoint you are trying to access is not allowing access from the domain you are using in the Power BI visual.
To resolve this issue, you need to configure the API to allow access from the domain or origin where your Power BI visual is hosted. You can do this by adding the domain or origin to the 'Access-Control-Allow-Origin' header in the API response.
Additionally, you can try to add the following header in the API response to allow credentials (if needed):
'Access-Control-Allow-Credentials': 'true'
If the issue still persists, you can try enabling the 'Allow any embedding' option in the Power BI report settings. This will allow the visual to load from any domain without any restrictions.
To enable this option, go to the report settings in the Power BI Service and under the 'Security' tab, toggle the 'Allow any embedding' option to 'On'.
Please note that enabling this option can pose security risks, so use it carefully and only if necessary.