Anaplan Mulesoft Connector Refresh Token Issue

Hi Team,

 

We are using Anaplan Mulesoft latest Connector for our client and With certificate authentication or basic authentication, Anaplan connector is failing while getting Refresh token after every 30 min. This behavior is happening randomly.

So when 30 min completed and we send a request it is failing because of refresh token issue. Please check below log and let me know if you can help us with that:

Error:
event:filled-position-EE-data_022420_192833 Failed to fetch attibutes {} org.mule.modules.mulesoftanaplanv3.internal.model.File for model BC727AB19BF644EA8DF844F853664B93 java.lang.NullPointerException at org.mule.modules.mulesoftanaplanv3.internal.client.AnaplanV2Client.buildRequestWithJwt(AnaplanV2Client.java:1554)

Message : Metadata key workspaceid || modelid ||fileName does not resolve to a known File. Element : post-fileupload-apiFlow/processors/7 @ system-anaplan-global-dev-api:post-fileupload-api.xml:33 (Execute file upload streaming) Element XML : <anaplan:execute-file-upload-streaming fileId="#[vars.fileAction]" doc:name="Execute file upload streaming" doc:id="e5962603-3a97-4666-8b60-99d71c08a304" config-ref="Anaplan_Config_Basic" workspaceId="${workspaceid}" modelId="${modelid}" chunkSize="10"></anaplan:execute-file-upload-streaming> Error type : ANAPLAN:CONNECTIVITY Payload Type : org.mule.runtime.core.internal.streaming.bytes.ManagedCursorStreamProvider -------------------------------------------------------------------------------- Root Exception stack trace: org.mule.runtime.api.exception.MuleRuntimeException: Metadata key <filename> does not resolve to a known File. at org.mule.runtime.extension.api.exception.ModuleException.<init>(ModuleException.java:66) at org.mule.runtime.extension.api.exception.ModuleException.<init>(ModuleException.java:76) at org.mule.modules.mulesoftanaplanv3.internal.error.exception.AnaplanConnectorException.<init>(AnaplanConnectorException.java:30)

Answers

  • Hey - Do you also experience the issue when you execute import with files (temporary files) instead of import using streaming? 

     

    Also have you configured the HTTP request connector to get the token and refresh as and when required? Here is a related link:  https://docs.mulesoft.com/connectors/http/http-authentication

  • I have observed that this issue is spread across all operations in the connector. Just wanted to update the community that we have fixed this issue in the connector for Mule 4 runtime and the connector is under certification with Mulesoft team at this time. It will be out very soon. 

     

  • @ashishgoyalCan you please tell me in which mule 4 version this issue was resolved. I am using Mule 4.3.0 and still facing the same issue. And we are seeing this issue even using the Basic authentication  

  • The issue was with Anaplan connector and not with Mule runtime. We have published the latest Anaplan connector on exchange 2 weeks back(3.1.0). Please use that.
  • I think you have answered the question here:

     

    "So when 30 min completed and we send a request it is failing because of refresh token issue"

     

    Once the token has expired, requesting a refresh will NOT extend the live of the token....Expired is Expired for good reasons.

     

    You must make a refresh BEFORE the time expires.

     

    if you have gone the REST API route, you can make a call to refresh your token before EVERY API call to ensure  the token has max file

     

    Happy to speak about this if you need to

     

     

  • here is what the Anaplan connector is doing before every call is made, assuming the calls is chained and runs within 30 min time period

     

     

    private byte[] refreshToken() {
    LOGGER.info(StringUtils.repeat("=", 80));
    LOGGER.info("Refreshing auth token...");
    try {
    RefreshTokenResp refreshTokenResp = getAuthClient().refreshToken(new String(authToken)); --> All API to extend live of token
    LOGGER.info(getDisplayText(refreshTokenResp.toString()));
    authTokenExpiresAt = refreshTokenResp.getItem().getExpiresAt();
    LOGGER.info(StringUtils.repeat("=", 80));
    this.authToken = refreshTokenResp.getItem().getTokenValue().getBytes();
    return this.authToken;
    } catch (FeignException e) {
    LOGGER.error("FeignException thrown. ", e);
    throw new AnaplanAPIException("Token Refresh failed!", e);
    }
    }

     

  • Hi Ashish,

     

    I'm trying to use the certificate authentication. I have copied the anplan-cert.jks file in the src/main/resources/certificate/anaplan-keystore.jks.

    I'm referring the certificate in the keystore file path: src/main/resources/certificate/anaplan-keystore.jks in the Anaplan connector. but while deploying the application/running I'm getting an error "(The system cannot find the path specified)" . However I m able to access using complete folder path - C:\MuleSoft\Anaplan_Cert.

     

    Could you help me how to acces the certificate in Anaplan connector using keystore file path? 

     

    Thanks,

    Vignesh.