Closed dzuluaga closed 2 weeks ago
Hi @dzuluaga From the newest update (1.0.3), the clear message Authentication required for Azure Maps. Please ensure valid credentials are provided.
will be visible in the logcat if the Azure Maps credentials are incorrect.
To provide more details, there were actually two issues, both related to the native implementation in android-omh-maps
.
The Azure Maps SDK introduced a new requirement where the map language must be explicitly set. Without calling:
AzureMaps.setLanguage(<LANGUAGE_TAG>)
the following error was thrown by the API:
{
"error": {
"message": "1 error occurred. More information provided in details.",
"details": [
{
"message": "The value \u0027\u0027 is invalid.",
"details": [],
"innerError": null,
"target": "Language",
"code": null
}
],
"innerError": null,
"target": null,
"code": "400 BadRequest"
}
}
To resolve this, we set the default language before creating the MapControl. Code link
Azure Maps will fail silently and display a blank map if an incorrect subscription key is provided.
To address this, we added a new listener for the OnAuthenticationNeeded
event, along with a mechanism to throw an error.
Hi @maciekBudzinski,
Thank you for the prompt response; that indeed fixed the issue.
I have one question, though—how did you retrieve the response from the API? It would be beneficial to surface this response to the RN module to better determine the root cause.
Additionally, while setting the default locale helps resolve the issue, I believe it’s important for the developer to have the ability to override the default system locale programmatically from the SDK as well. Could this functionality be provided through the RN Maps module?
I’m reopening the bug to track these points, but please let me know if it would be more appropriate to raise independent bugs for these requirements.
Thanks again!
Hi @dzuluaga, thanks for the feedback. Let me respond to it.
I have one question, though—how did you retrieve the response from the API? It would be beneficial to surface this response to the RN module to better determine the root cause.
To retrieve the response from the API, I've used App Inspection tool built in the Android Studio. Unfortunately, there is no way to get this response from the code.
I believe it's important for the developer to have the ability to override the default system locale programmatically from the SDK as well. Could this functionality be provided through the RN Maps module?
I agree that it would be a nice addition for the maps API to provide an option to change the map language. However, as this feature was not included in the initial project scope, implementing it for all providers (for Android and React Native) would require additional time and resources.
Closing the issue since we have eliminated the root cause. We can discuss future language support addition on next meeting 👍
Thanks for fixing this and for the detailed explanation, @maciekBudzinski. Let's make sure we keep the potential downsides visible from the start. This will help everyone understand the reasons behind certain decisions and be aware of any workarounds. It also allows the team to capture any technical debt related to the underlying SDK, which is crucial for future capability enhancements :)
Adam, yes, let's discuss this in the next call.
Urgency: This is a blocking issue that significantly hinders development and troubleshooting.
When the
AZURE_MAPS_SUBSCRIPTION_KEY
for the map is not set properly, the map fails silently and displays as empty. This behavior makes it extremely difficult to troubleshoot the issue since the developer is not provided with any error details. This issue is causing delays in development and must be addressed urgently.Expected Behavior:
If the
AZURE_MAPS_SUBSCRIPTION_KEY
is not configured correctly, the map should throw an error, similar to the error returned by the Azure Maps SDK. This would help developers identify and fix the issue more quickly, preventing unnecessary delays.Current Behavior:
When the
AZURE_MAPS_SUBSCRIPTION_KEY
is not properly set:Steps to Reproduce:
AZURE_MAPS_SUBSCRIPTION_KEY
or with an incorrectAZURE_MAPS_SUBSCRIPTION_KEY
.Possible Solution:
Implement a check for the
AZURE_MAPS_SUBSCRIPTION_KEY
during the map initialization process. If theAZURE_MAPS_SUBSCRIPTION_KEY
is invalid or not set, throw the same error that the Azure Maps SDK would return in such a case. This will provide developers with the necessary information to correct the issue and unblock the development process.Additional Context:
Due to the critical nature of this issue, prompt action is required to resolve it. Improving the error handling in this scenario will not only enhance the developer experience but also prevent delays in project timelines.