Error while substituting the templates only after installation as custom app

:point_right: I’m developing a custom app and it works perfectly locally. However, I got the error below when performing an external request in production. I followed all the steps for packaging, upload and install as a Custom app in developer portal.

Error while substituting the templates

I’m using:
“platform-version”: “2.3”
“node”: “18.12.1”
“fdk”: “9.0.2”

Hey @pedralho,
Can you share your requests.json and the method with params while invoking the template?

      let result = await client.request.invokeTemplate("getGithubRepositories", {
        context: {
          per_page: 100,
          sort: "full_name"
        },
        cache: true,
        ttl: 604800000
      }); 
      let response = JSON.parse(result.response);
  "getGithubRepositories": {
    "schema": {
      "protocol":"https",
      "method": "GET",
      "host": "api.github.com",
      "path": "/orgs/<%= iparam.githubOrganization %>/repos",
      "headers": {
        "Accept": "application/vnd.github+json",
        "Authorization": "Bearer <%= iparam.githubToken %>",
        "X-GitHub-Api-Version": "2022-11-28",
        "user-agent": "request"
      },  
      "query": {
        "per_page": "<%= context.per_page %>",
        "sort": "<%= context.sort %>"
      }   
    }   
  }

Hey @jones, could you get any insight from the request.json and the code I’ve sent you earlier?

@zach_jones_noel @Raviraj @Nadeem_Bhati @Developer-Platform, do you have any suggestion? How can I get more information about the error?

I found the problem and it was a typo (=> instead of %> closing the template) in a request chained with the one I provided earlier:

  "getGithubRepositoriesNextPages": {
    "schema": {
      "protocol":"https",
      "method": "GET",
      "host": "api.github.com",
      "path": "/organizations/<%= context.requestHash %>/repos",
      "headers": {
        "Accept": "application/vnd.github+json",
        "Authorization": "Bearer <%= iparam.githubToken %>",
        "X-GitHub-Api-Version": "2022-11-28",
        "user-agent": "request"
      },  
      "query": {
        "page": "<%= context.page %>",
        "per_page": "<%= context.itemsPerPage %>",
        "sort": "<%= context.sort =>"
      }   
    }   
  },
"sort": "<%= context.sort =>"

instead of

"sort": "<%= context.sort %>"

A question remains: Why does it work on development mode? (I only get the problem on production)

Thank you for the information, @pedralho

Allow us until tomorrow to thoroughly investigate the matter and provide a comprehensive update.

@pedralho
Due to security reasons, our production environment has more stringent checks compared to the local FDK. This discrepancy could be the reason for the error you encountered in production.

Moving forward,We will work diligently to align these environments, maintaining the necessary security measures while reducing the risk of errors in the production environment.

1 Like

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