pedralho
(Andre Pedralho)
July 14, 2023, 11:00pm
1
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?
pedralho
(Andre Pedralho)
July 19, 2023, 11:51am
4
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 %>"
}
}
}
pedralho
(Andre Pedralho)
July 31, 2023, 6:54pm
5
Hey @jones , could you get any insight from the request.json and the code I’ve sent you earlier?
pedralho
(Andre Pedralho)
August 3, 2023, 1:42pm
6
@zach_jones_noel @Raviraj @Nadeem_Bhati @Developer-Platform , do you have any suggestion? How can I get more information about the error?
pedralho
(Andre Pedralho)
August 3, 2023, 3:15pm
7
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
system
(system)
Closed
August 10, 2023, 1:18pm
10
This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.