Custom app issue

Raising this on behalf of one of our customers.

Seems there is change in FDK version from Freshdesk and it looks like Fresh Desk stopped supporting recommended FDK version 2 API. Please find below the log which we have collected during our lab test.

PS D:\My Reposit\NaviFreshdesk> fdk validate

Please ensure that the following are addressed for quick review process.

[WARN] app\scripts\app.js::8: Expected rejection to be handled.

[WARN] app\scripts\app.js::28: 'loggedInUserId' declared and assigned in different scopes. Possible asynchronous race condition.

[WARN] app\scripts\app.js::29: 'loggedInUserName' declared and assigned in different scopes. Possible asynchronous race condition.

[WARN] app\scripts\app.js::41: Function has a complexity of 18. Maximum allowed is 7.

[WARN] app\scripts\app.js::51: 'logginuserid' declared and assigned in different scopes. Possible asynchronous race condition.

[WARN] app\scripts\app.js::52: 'logginusername' declared and assigned in different scopes. Possible asynchronous race condition.

[WARN] app\scripts\app.js::58: Expected rejection to be handled.

[WARN] app\scripts\app.js::74: possible deprecated API usage detected

[WARN] app\scripts\app.js::87: Expected rejection to be handled.

[WARN] app\scripts\app.js::87: possible deprecated API usage detected

[WARN] app\scripts\app.js::120: 'logginusername' declared and assigned in different scopes. Possible asynchronous race condition.

[WARN] app\scripts\app.js::149: possible deprecated API usage detected

[WARN] app\scripts\app.js::182: 'logginuserid' declared and assigned in different scopes. Possible asynchronous race condition.

[WARN] app\scripts\app.js::183: 'logginusername' declared and assigned in different scopes. Possible asynchronous race condition.

[WARN] app\scripts\app.js::199: possible deprecated API usage detected

[WARN] app\scripts\app.js::215: Expected rejection to be handled.

[WARN] app\scripts\app.js::215: possible deprecated API usage detected

[WARN] app\scripts\app.js::234: Expected rejection to be handled.

[WARN] app\scripts\app.js::234: possible deprecated API usage detected

[WARN] app\scripts\app.js::249: Expected rejection to be handled.

[WARN] app\scripts\app.js::249: possible deprecated API usage detected

 

Your app might be using one or more API endpoints that will be deprecated soon. Please go through the deprecation notice (https://community.freshworks.dev/t/freshservice-rest-api-v1-deprecation-notice/5899) to find alternate resources.

                                                                                                                                                                                                                   ind alternate resources. 

Validation Successful
PS D:\My Reposit\NaviFreshdesk> fdk pack

Please ensure that the following are addressed for quick review process.

[WARN] app\scripts\app.js::8: Expected rejection to be handled.

[WARN] app\scripts\app.js::28: 'loggedInUserId' declared and assigned in different scopes. Possible asynchronous race condition.

[WARN] app\scripts\app.js::29: 'loggedInUserName' declared and assigned in different scopes. Possible asynchronous race condition.

[WARN] app\scripts\app.js::41: Function has a complexity of 18. Maximum allowed is 7.

[WARN] app\scripts\app.js::51: 'logginuserid' declared and assigned in different scopes. Possible asynchronous race condition.

[WARN] app\scripts\app.js::52: 'logginusername' declared and assigned in different scopes. Possible asynchronous race condition.

[WARN] app\scripts\app.js::58: Expected rejection to be handled.

[WARN] app\scripts\app.js::58: possible deprecated API usage detected

[WARN] app\scripts\app.js::74: Expected rejection to be handled.

[WARN] app\scripts\app.js::74: possible deprecated API usage detected

[WARN] app\scripts\app.js::87: possible deprecated API usage detected

[WARN] app\scripts\app.js::120: 'logginusername' declared and assigned in different scopes. Possible asynchronous race condition.

[WARN] app\scripts\app.js::149: possible deprecated API usage detected

[WARN] app\scripts\app.js::182: 'logginuserid' declared and assigned in different scopes. Possible asynchronous race condition.

[WARN] app\scripts\app.js::183: 'logginusername' declared and assigned in different scopes. Possible asynchronous race condition.

[WARN] app\scripts\app.js::199: possible deprecated API usage detected

[WARN] app\scripts\app.js::215: Expected rejection to be handled.

[WARN] app\scripts\app.js::215: possible deprecated API usage detected

[WARN] app\scripts\app.js::234: Expected rejection to be handled.

[WARN] app\scripts\app.js::234: possible deprecated API usage detected

[WARN] app\scripts\app.js::249: Expected rejection to be handled.

[WARN] app\scripts\app.js::249: possible deprecated API usage detected

 
Your app might be using one or more API endpoints that will be deprecated soon. Please go through the deprecation notice (https://community.freshworks.dev/t/freshservice-rest-api-v1-deprecation-notice/5899) to find alternate resources.

 

App being packed in Node v14.20.1 using FDK 8.6.7

App packed successfully at \dist\NaviFreshdesk.zip

Upload this file to the marketplace by following the instructions at https://developer.freshdesk.com/v2/docs/freshdesk-apps/

Please help

The fdk pack and fdk validate logs indicate that the app is validated and packed successfully. fdk pack calls fdk validate, which is why you see the same warnings show up. Let me address the few warnings I see in the logs.

Does this app call the Freshservice v1 REST API endpoints? Freshservice v1 API has been deprecated, which could be why you are seeing this error. If yes, you must move to the corresponding Freshservice v2 API.

This warning is related to the Freshservice v1 API point above.

This warning appears when the app does not handle a Promise rejection. Wrap the calling code inside a try...catch block if using async functions, or add a corresponding error handler if using Promise chaining (.then(fn).catch(fn)).

This warning suggests that a function has too many branches. Break that function body into multiple functions instead of relying on deeply nested if...else conditions.

1 Like

Hi @kaustavdm
Jumping in here as I have similar warnings when validating.

The validation does for example react on the agents endpoint:

...
const agentUrl = 'https://<%=iparam.SubDomain%>.freshdesk.com/api/v2/agents/';
...

Which is a V2 endpoint.

Best,
Tom

Thanks for your input, @ThomasH.

@Shiny_Grace @ThomasH There was a security update earlier restricting access to specific admin endpoints from Request Method. Can you cross-check these two articles and see if the endpoints you are calling in your respective apps are among the restricted ones?

Hello @kaustavdm
Thank you for the reply - So validation does not check for how these endpoints are used?
As I only do get requests to the agent endpoint.

I find the warning a bit misleading if it says, “will be deprecated soon” although you can hit an endpoint, which is already restricted. Could that message get a bit clearer?

Best,
Tom

Thanks for the clarification, @ThomasH. I agree with you that this is not a good developer experience.

@Raviraj Can you help answer Thomas’s query and help debug as needed?

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