Issue with GET Request in Marketplace Application

Hi Team,

I’m encountering an issue with a GET request made using the request method in my marketplace application. Surprisingly, this method works perfectly for other customers except for one specific case. The error message received is [insert error message here].

Would appreciate any insights or suggestions on how to troubleshoot and resolve this issue. Thank you!

Error:
{
“headers”: {},
“errorSource”: “PLATFORM”,
“response”: “Cannot read properties of undefined (reading ‘type’)”,
“status”: 500
}

“requestFunction”: {
“schema”: {
“method”: “GET”,
“protocol”: “https”,
“host”: “baseUrl”,
“path”: “/path”,
“headers”: {
“Authorization”: “Bearer <%= access_token %>”,
“Accept”: “application/json”
}
},
“options”: {
“isOAuth”: true
}
},

Hey @Gopi,

Is the host masked for sharing here? Also, can you share the oauth_configs.json?

Are the POST/PUT HTTP methods working as expected with the same configs?

Hi Jones,

Good Day!

The host has been masked for sharing purposes. Previously, the functionality was operational, and it currently works on some instances but not on others. Here is my oauth_configs.json file for reference.

{
“client_id”: “client_id”,
“client_secret”: “client_secret”,
“authorize_url”: “Log in with Atlassian account”,
“token_url”: “https://auth.atlassian.com/oauth/token”,
“options”: {
“grant_type”: “refresh_token”,
“scope”: “read:jira-work manage:jira-webhook manage:jira-project manage:jira-configuration read:jira-user write:jira-work manage:jira-data-provider offline_access”
},
“token_type”: “account”
}

Hi @zach_jones_noel ,

Can you please look into this?

Hello @Gopi could you try testing the application through Postman/Thunderclient and see if it works just to be sure

Hi @Debjani ,

Yes, I’ve tested it with Postman, and the functionality is working. However, the issue seems to be intermittent, as it works fine in some instances and not in others.

Getting the below error,
{
“headers”: {},
“errorSource”: “PLATFORM”,
“response”: “Cannot read properties of undefined (reading ‘type’)”,
“status”: 500
}

Could you please give more details about the conditions/instances or accounts where you see the app behaving differently?

Hi @Debjani ,

We’ve encountered an issue with our marketplace application in some instances on the Freshchat platform. While attempting to install or reauthorize the application, we’re encountering errors.

During the installation process, after completing OAuth, we’re encountering the following error when making a GET request on the configurations page:

{
“headers”: {},
“errorSource”: “PLATFORM”,
“response”: “Cannot read properties of undefined (reading ‘type’)”,
“status”: 500
}

Similarly, when trying to reauthorize the application post-installation, we’re encountering the following error:

{
“url”: “/client/”,
“errorMessage”: “API call failed with statusCode 500.”,
“message”: “App Reauthorization failed”
}

Hi @Debjani ,

We urgently need an update on this matter. Our marketplace application has been published, and numerous customers are attempting to install it. However, they’re unable to use the application due to this issue. Please inform us promptly if you require any further action from our end. Thank you

Hi @Gopi

Could you please share the code snippet for request.invokeTemplate()? It seems that the response data you’re expecting might be broken, resulting in the following error

"response": "Cannot read properties of undefined (reading 'type')"

Hi @vangakirankumarreddy ,

  const jiraCloudidRes = await window.client.request.invokeTemplate(
    "jiraAuthenticate"
  );
  const cloudid = JSON.parse(jiraCloudidRes.response);

The snippet provided makes a request to authenticate with Jira Cloud. It’s functioning properly in some instances but not in others.

Your last reply triggered something in my mind.
I once had an issue with Salesforce Commerce Cloud, where I got the same status 500 error.

For better understanding the usecase:
Customer gives us an order reference via contact form and a Freshdesk app tries to fetch that order from Salesforce on ticket creation.
Now not every customer gets the order number correct - Which leads to a 404 response from Salesforce. So far so good.

Now the issue:
Within the 404 response some header was set to a value, Freshdesk was not able to process (I think it was the content type). That lead to that same status 500 error you are experiencing.

So it may be the response from Jira, that the Freshworks part is not able to understand.
In my case, I was fine with the error by assuming/hoping that every status 500 response is in fact a 404.

I am not sure, but I think I found out what the issue was when testing the app in debug mode, because it said exactly which part it could not process. Not sure, but you could try. You would need to connect to a Jira instance, where the issue occurs - Don’t know if one of your customers would give you that information.

Hi @ThomasH

Thank you for sharing this information. I’ll give it a try.