FC API working in local but throwing error in server - JWT strings must contain exactly 2 period characters -

I am trying to migrate one FD custom app which involves Freshchat API call to fetch conversation details from Freshchat.

App is working fine in local, however, when I deploy, I get below error:

{“success”:false,“error_code”:0,“error_message”:“JWT strings must contain exactly 2 period characters. Found: 1”}

API call - return $request.invokeTemplate(“getConversation”, {
“context”: { “appendurl”:appendurl }
});

“getConversation”:{
“schema”: {
“protocol”: “https”,
“host”: “<%= iparam.FCdomain %>”,
“path”: “/<%= context.appendurl %>”,
“method”: “GET”,
“headers”: {
“Authorization”: “Bearer <%= (iparam.FCapikey) %>”,
“Content-Type”: “application/json”
}
}
}

Hey @Dev_Aditya,

{“success”:false,“error_code”:0,“error_message”:“JWT strings must contain exactly 2 period characters. Found: 1”}

Is the error you see when you try to publish the app? Is this a new version of an existing app?

Hi Jones,
No we don’t get any error while publishing the app. Error occurs in real time scenario when app is executed depending on code logic

Yes, we migrated this app to V2.3. It was working in V2.2

You mean that is the response from request.invokeTemplate?

API call - return $request.invokeTemplate(“getConversation”, {
“context”: { “appendurl”:appendurl }
});

In this, appendurl value is set? And you are using retrieve conversation API?

Also, Bearer <%= (iparam.FCapikey) %> should be Bearer <%= iparam.FCapikey %> as the value is not intended to be encoded.

Hi Jones,

  1. Yes, error response is from “request.invokeTemplate”
  2. Yes, appendURL is correct. As mentioned, code is working in local. Error comes only after deployment
  3. I tried that, still no luck

Hi Jones,
I tested again, it worked. It seems app took sometime to load app properly. So, issue was “(” which was not required.

1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.