PLATFORM error on custom app when running on server, but no error in local dev environment

working on a custom app using FDK 9.0.5, Node v18.18.2.

Used sample app at request-method-samples/product-samples/freshservice at main · freshworks-developers/request-method-samples (github.com) and modified as needed and received error, also tried code exactly as presented with same error. In both cases there are no issues when using local development environment.

app.js

var client;

(async function init() {
  client = await app.initialized();
  client.events.on('app.activated', renderStarWarsInfo);
})();

//To demonstrate a simple GET request
async function getStarWarsChar() {
  const starwarsCharsElement = document.querySelector('#starWarsCharsCount');
  try {
    let starwarsChars = await client.request.invokeTemplate(
      'getStarWarsPeople',
      {}
    );
    let starwarsCharsJSON = JSON.parse(starwarsChars.response);
    starwarsCharsElement.innerHTML = starwarsCharsJSON.count;
  } catch (err) {
    console.error(err);
    starwarsCharsElement.innerHTML = `-` + err;
  }
}

async function renderStarWarsInfo() {
  await getStarWarsChar();
}

manifest.json

{
  "platform-version": "2.3",
  "product": {
    "freshservice": {
      "location": {
        "asset_sidebar": {
          "url": "index.html",
          "icon": "styles/images/icon.svg"
        }
      },
      "requests": {
        "getStarWarsPeople": {}
      }
    }
  },
  "engines": {
    "node": "18.18.2",
    "fdk": "9.0.5"
  }
}

requests.json

{
  "getStarWarsPeople": {
    "schema": {
      "method": "GET",
      "host": "swapi.dev",
      "path": "/api/people"
    }
  }
}

index.html

<html>
  <head>
    <link rel="stylesheet" type="text/css" href="./styles/style.css" />
    <script
      type="module"
      src="https://unpkg.com/@freshworks/crayons@v4/dist/crayons/crayons.esm.js"
    ></script>
    <script
      nomodule
      src="https://unpkg.com/@freshworks/crayons@v4/dist/crayons/crayons.js"
    ></script>
    <script src="{{{appclient}}}"></script>
  </head>

  <body>
    <div class="fw-card-2 fw-p-12 fw-flex fw-flex-row">
      <section class="fw-flex-grow">
        <h3 class="fw-type-h5 fw-my-0">Star Wars characters</h3>
        <p class="fw-type-xs fw-my-0" id="starWarsCharsCount"></p>
      </section>
    </div>
  </body>
  <script defer src="./scripts/app.js"></script>
</html>

1 Like

I tried the same app and it seems to be working.
Can you please share the appID and region, so that we can check the logs from our end.

1 Like

We are hitting the same problem too. It works in local dev and not as a custom app.

The AppId is 85712. I’m not sure where to find the region, but we are located in the US.

HI @Dustin_Scott , @shalabi

Could you verify whether the app has been published or if it’s currently in a testing phase? If it’s still in a test state, please utilize the “save and publish” functionality to transition it into a fully published app, and then retest the scenario accordingly.

Regards
Nadeem

cc @Logesh_Narayanan

Thanks Nadeem,
Publishing the app resolved the problem. Is this always going to be the solution, or will we be able to test apps once installed prior to giving access to all users?

Dustin

@Dustin_Scott
We would like to inform you that we have already rolled out the fix on last Friday .

Regards
Nadeem

hi ,
i developed a app and the app makes calls to the freshdesk api’s provided the subdomain and apikey, the app makes successful api’s calls to freshdesk api’s while developing, but when i pushed my app to marketplace the api’s calls fail with status code 401 even after providing the apikey and subdomain.

request.json
{
“GetTicketDetails” : {
“schema”: {
“method”: “GET”,
“protocol”: “https”,
“host”: “<%= iparam.subdomain %>.freshdesk.com”,
“path”: “/api/v2/tickets/<%= context.ticketid %>”,
“headers”: {
“Authorization”: “Basic <%= encode(iparam.apikey) +‘:X’ %>”,
“Content-Type”: “application/json”
}
}
}

response of the api
{
“status”: 401,
“headers”: {
“date”: “Tue, 05 Dec 2023 09:57:02 GMT”,
“content-type”: “application/json; charset=utf-8”,
“transfer-encoding”: “chunked”,
“connection”: “close”,
“status”: “401 Unauthorized”,
“x-request-id”: “c4e6126d-463d-495c-b7ee-f12834e38b3d”,
“x-freshdesk-api-version”: “latest=v2; requested=v2”,
“content-security-policy”: “default-src ‘self’; connect-src ‘self’ *.freshconnect.io/ *.freshworks.com/ *.freshdesk.com/ *.freshworksapi.com/ *.freshdeskusercontent.com/ *.freshdeskusercontent-euc.com/ *.freshdeskusercontent-in.com/ .freshdeskusercontent-aus.com/ .fconstage.io/ analytics.inlinemanual.com/__profile analytics.inlinemanual.com/__ptm backend.getbeamer.com/ heapanalytics.com/ d3h0owdjgzys62.cloudfront.net/ d2uy6ubiilaqku.cloudfront.net/assets/ dcdu85ocrj5q6.cloudfront.net/ dtdafz6i4gvv1.cloudfront.net/ d3r4aewxkdubw4.cloudfront.net/ d2lz1e868xzctj.cloudfront.net/ rum.haystack.es/freshdesk/analytics fonts.googleapis.com/ fonts.gstatic.com/ Sign In | Sentry wss://.freshworksapi.com/ wss://.freshdesk.com/ fg8vvsvnieiv3ej16jby.litix.io/ distillery.wistia.com/ pipedream.wistia.com/ freshworks.asknice.ly/ embedwistia-a.akamaihd.net/ embed-fastly.wistia.com/ maps.googleapis.com/ graph.microsoft.com/v1.0/ freshcaller-attachments.s3.amazonaws.com/production/ euc-freshcaller-attachments.s3.eu-central-1.amazonaws.com/production/ au-freshcaller-attachments.s3-ap-southeast-2.amazonaws.com/production/ in-freshcaller-attachments.s3.ap-south-1.amazonaws.com/production/ pubsub.rtschannel.com/ api.fdcollab.com/ wss://pubsub.rtschannel.com/ data: blob: api.appcues.net/ wss://api.appcues.net/ fast.appcues.com/ cdn.jsdelivr.net/npm/@freshworks/crayons-icon@next/dist/ translate.googleapis.com/translate_a/t translate.googleapis.com/element/log fast.wistia.net/ fast.wistia.com/ embed-cloudfront.wistia.com/deliveries/ app.inlinemanual.com/ client-api.auryc.com/ *.surveyserv.com *.freshsurvey.com; font-src ‘self’ *.freshdesk.com/ fonts.gstatic.com/ fonts.googleapis.com/ cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/fonts/ fast.wistia.net/ fast.wistia.com/ cdn.inlinemanual.com/inm/author/ data:; frame-src ‘self’ https:; img-src ‘self’ https: data: blob:; media-src ‘self’ https: blob:; object-src ‘none’; script-src ‘self’ *.freshworksapi.com/ *.freshworks.com/ *.myfreshworks.com/ *.freshdesk.com/ *.freshchat.com/ *.freshconnect.io/ *.freshcloud.io/ *.fconstage.io/ wchat.freshchat.com/js/ d3h0owdjgzys62.cloudfront.net/ d2uy6ubiilaqku.cloudfront.net/ dtdafz6i4gvv1.cloudfront.net/ dcdu85ocrj5q6.cloudfront.net/ d3r4aewxkdubw4.cloudfront.net/ app.getbeamer.com/js/beamer-embed.js analytics.inlinemanual.com/ cdn.inlinemanual.com/embed/ polyfill.io/v3/polyfill.js cdn.heapanalytics.com/ cdnjs.cloudflare.com/ js.chargebee.com/v1/chargebee.js js.braintreegateway.com/v1/braintree.js static.freshdev.io/ fast.wistia.net/ fast.wistia.com/ static.getbeamer.com/ calendly.com/ unpkg.com/@webcomponents/webcomponentsjs@2.4.3/custom-elements-es5-adapter.js unpkg.com/@webcomponents/webcomponentsjs@2.4.3/webcomponents-loader.js js-agent.newrelic.com/ www.googletagmanager.com/gtag/js static.asknice.ly/dist/standalone/asknicely-in-app-conversation.js www.dropbox.com/static/api/2/dropins.js js.live.net/v7.2/OneDrive.js apis.google.com/ asknice.ly bam.nr-data.net/ www.google-analytics.com/analytics.js maps.googleapis.com/ unpkg.com/@freshworks/crayons@v3/dist/crayons/crayons.esm.js unpkg.com/@freshworks/crayons@v3/dist/crayons/crayons.js s3.amazonaws.com/freshcaller-widget-loader/ in-freshcaller-widget-loader.s3.ap-south-1.amazonaws.com/ s3.eu-central-1.amazonaws.com/euc-freshcaller-widget-loader/ au-freshcaller-widget-loader.s3-ap-southeast-2.amazonaws.com/ www.dropbox.com/static/api/1/dropbox.js fast.appcues.com/ translate.google.com/translate_a/element.js translate.googleapis.com//translate_http//js/ translate-pa.googleapis.com/v1/supportedLanguages cdn.surveyserv.com/widget.min.js cdn.freshdev.io/assets/marketplace-heap.js cdn.freshcloud.io/assets/marketplace-heap.js cdn.inlinemanual.com/inm/author/ app.inlinemanual.com/ *.surveyserv.com *.freshsurvey.com ‘unsafe-inline’ ‘unsafe-eval’; style-src ‘self’ *.freshworks.com *.myfreshworks.com/ *.freshchat.com/ d3h0owdjgzys62.cloudfront.net/ dcdu85ocrj5q6.cloudfront.net/ dtdafz6i4gvv1.cloudfront.net/ d3r4aewxkdubw4.cloudfront.net/ d2uy6ubiilaqku.cloudfront.net/ fonts.googleapis.com/ app.getbeamer.com/styles/beamer-embed.css *.freshdesk.com/ calendly.com/ unpkg.com/@webcomponents/webcomponentsjs@2.4.3/custom-elements-es5-adapter.js unpkg.com/@webcomponents/webcomponentsjs@2.4.3/webcomponents-loader.js static.asknice.ly/dist/standalone/asknicely-in-app-conversation.css fast.appcues.com/ asknice.ly *.surveyserv.com *.freshsurvey.com cdn.inlinemanual.com/inm/author/ ‘unsafe-inline’; worker-src ‘self’ blob:”,
“cache-control”: “no-cache”,
“x-xss-protection”: “1; mode=block”,
“x-content-type-options”: “nosniff”,
“set-cookie”: [
“_x_w=7_1; path=/; HttpOnly; secure”,
“_x_m=x_c; path=/; HttpOnly; secure”
],
“x-fw-ratelimiting-managed”: “true”,
“x-ratelimit-total”: “50”,
“x-ratelimit-remaining”: “47”,
“x-ratelimit-used-currentrequest”: “2”,
“x-envoy-upstream-service-time”: “49”,
“x-trace-id”: “00-1183a86d7138870eb0f68b5a5455566a-9b41da2d23efb8b3-00”,
“nel”: “{ "report_to": "nel-endpoint-freshdesk", "max_age": 2592000, "include_subdomains": true}”,
“report-to”: "{ "group": "nel-endpoint-freshdesk", "max_age": 2592000, "include_subdomains": true, "endpoints": [{"url": "https://edge-admin.ap-south-1.freshedge.net/nelreports/freshdesk\“}]}”,
“server”: “fwe”
},
“response”: “{"code":"invalid_credentials","message":"You have to be logged in to perform this action."}”,
“errorSource”: “APP”,
“attempts”: 1
}

it doesn’t seems to be fixed in fdk version “9.0.5”, do i need to upgrade to “9.0.6” ??