Getting Timeout error (504) on a specific azure API request

We are trying to configure fresh service using the azure URL.

  1. At first we tried using the https://dev.azure.com, it worked well. The API request gave 200 success response.
  2. While we try using the client VSTS azure link https://tfs-prod.endurancebermuda.net, it always throws a 504 timeout error. But in postman it gives as the response using the same VSTS URL.
    In this above case, The Client VSTS azure only can be accessed in the client Network.

Is this issue because of any constrain blockers in freshservice or any other reason? Kindly assist us.

I have attached the screenshot for your reference.



Hi,Sanjana
While configuring the app did you add https://tfs-prod.endurancebermuda.net to whitelisted domains? in manifest.json. Something like this

"whitelisted-domains": ["https://tfs-prod.endurancebermuda.net](https://tfs-prod.endurancebermuda.net","https://freshworks1343.freshdesk.com"]

Hello @Sanjana_Vijay

Welcome to the Freshworks Community!

Based on the information you have shared, I am assuming that when you try this API from your Postman client, your laptop or Postman instance is within the client’s network.

Assuming you are using the Request Method to make this API call, when you make the same API request from an app, the app does not make the request from within the client’s network.

You have a couple of options to proceed from here.

  1. If the internal endpoint (https://tfs-prod.endurancebermuda.net/) can support cross-origin requests, or can be configured to allow cross-origin requests, make this API request without using the Request Method - eg: using axios. This is only safe if the request needs to be made from the configuration/iparams page. Making a similar request from a page where agents use the app will likely leak secrets to the agent, so this is not recommended.
  2. If the internal endpoint can be configured to allow-list requests from Freshworks, update the configuration of this endpoint to allow-list the IPs mentioned in the “IP Ranges” section here - Request Method
1 Like

Yes, i did.
Screenshot from 2023-04-20 20-35-50

While using axios, i am getting

AxiosError: Network Error\n at u.onerror (https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js:1:22257)

How to resolve this error.

Well, it would appear that a lot more is blocked by the intranet you are working within. In this case, it looks like you are not allowed to access jsdeliver to load Axios itself. Can you ask your IT team to allow access to jsdeliver? Or perhaps another npm hosting service they are OK to allow access to?

Our internal IT team is not blocking. While running in Local the axios is working fine but after installing the pack in freshservice then it is not working. Can you please help me in this?

I am assuming that this error -

AxiosError:
Network Error\n at u.onerror (https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js:1:22257)

was noted from the browser console, is that right @Sanjana_Vijay ?

When the app loads within Freshservice in the browser, there should be no difference between testing the app locally and when it is installed as a custom app in Freshservice if you are using axios to make requests.

Do you mind sharing the code snippet that is causing this error? Do you also have more details in the browser console log that might be relevant to the error? If so, please do share the same.

Can you also confirm what you mean by “running in the local” here? Were you referring to the steps listed here wrt testing your Front-end app?

Yes!!! @satwik

True, But there is an axios error while running as custom app. I have attached screenshot for your reference.

<head>
    <link rel="stylesheet" type="text/css" href="https://static.freshdev.io/fdk/2.0/assets/freshservice.css" />
    <link rel="stylesheet" type="text/css" href="./assets/iparams.css" />
    <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/css/select2.min.css" rel="stylesheet" />
      <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/js/select2.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>

</head>

This is the html header where i have imported the axios.

const validatePatToken = async (azureInfo) => {
	// <-- API call to validate the Azure Personal Access Token
	// var axioss = require('axios');
	try {
		const azureUrl = `https://${azureInfo.domainUrl}/${azureInfo.orgName}/_apis/projects/?api-version=5`;
		const authStr = `${azureInfo.emailId}:${azureInfo.patKey}`;
		const headers = {
			"Content-Type": "application/json",
			Authorization: `Basic ${btoa(authStr)}`,
		};
		
		return await axios.get(azureUrl, { headers});
	} catch (error) {
		console.log(error);
		throw error;
	}
};

The above code is where i used axios for get request.



“running in the local” here? yes.

Thanks for sharing the details @Sanjana_Vijay

You can see the error trace clearly calling out CORS as the problem. As I had mentioned above, axios will only work if your target endpoint supports CORS requests. It clearly does not.

Access to XMLhttprequest at … dev.azure.com… from origin https://d3hw0d… blocked by CORS policy

You can learn more from this stackoverflow thread.

Either the dev.azure.com endpoint needs to support CORS for your app to work, or it has to allow access over the Internet from the IP addresses the Freshworks platform will use to proxy the call to it via the Request Method. I don’t see any other way to make this work.

it has to allow access over the Internet from the IP addresses the Freshworks platform will use to proxy the call to it via the Request Method. I don’t see any other way to make this work.

Can you please help me to make this work?

The only person who can make this work is the administrator who owns the dev.azure.com server. You will need to describe the problem to them and have them address it so the app can make requests.

To make axios or any request to work on https://tfs-prod.endurancebermuda.net, the admin of this server should allow request. Is this right @satwik ?

Yes @Sanjana_Vijay
You will need to get in touch with the admin and ask for their help in enabling this.

@satwik Can you please share related document for the admin reference.