Thursday, October 21, 2021

Microsoft Translator Service - Issue while fetching the Access Token | AEM(Adobe Experience Manager)

Microsoft Translator - Issue while fetching the Access Token | AEM(Adobe Experience Manager) Translation

I was getting a "Failed To connect" message while trying to enable the configuration for MS Translator from AEM

Creating a Translation Integration Configuration - Tools -> Cloud Services -> Translation Cloud Services.

AEM Content Translation

AEM Content Translation

Receiving "Failed to Connect" error while the connector trying to establish the connection with the Azure Translator service.

The below error was displayed in the error.log but the error was not providing the real root cause

21.10.2021 11:06:02.390 *ERROR* [[0:0:0:0:0:0:0:1] [1634832361866] POST /services/accesstoken/verify HTTP/1.1] service: Uncaught Throwable
java.lang.NullPointerException: null
21.10.2021 11:06:02.391 *WARN* [[0:0:0:0:0:0:0:1] [1634832361866] POST /services/accesstoken/verify HTTP/1.1] Requested Path /services/accesstoken/verify.servlet is not in available search paths

Enabled a logger to capture the MS Translation Connector logs with Trace level - the error messages are printed in Trace level.

AEM Logger

The below error was displayed  in the log file

21.10.2021 11:35:04.769 *TRACE* [[0:0:0:0:0:0:0:1] [1634834104174] POST /services/accesstoken/verify HTTP/1.1] com.adobe.granite.translation.connector.msft.core.impl.util.AccessTokenImpl Error while accessing token -->{"error":{"code":"401","message": "Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource."}}   - Tarce Log

The correct Token was configured also the API endpoint is enabled from the MS Translation Connector.

The request to get the access token to the following API was failing with a 401 error —

The actual root cause was the region configured while creating the translation service in the Azure portal, I have selected the region as East US

AEM Content Translation

But the region  for the Microsoft Translator should be enabled as global instead of selecting the local regions - the MS Translator API only works with global regions

The issue is resolved after enabling Translator service with the global region

MS Translator

AEM Content Translation

No comments:

Post a Comment