I’m building a Freshdesk app using platform version 2.3. I need to invoke a serverless function (createTicket
) using client.request.invoke
. But every time I try, I get:
{ message: “Requested function ‘createTicket’ not found or registered”, status: 404, errorSource: ‘APP’ }
No matter what I do, this function never appears as registered in the console when I run fdk run
.
Current Setup
1. manifest.json
{
“platform-version”: “2.3”,
“product”: {
“freshdesk”: {
“location”: {
“ticket_sidebar”: {
“url”: “index.html”,
“icon”: “styles/images/icon.svg”
}
}
}
},
“functions”: {
“createTicket”: {
“timeout”: 10
}
},
“features”: {
“appclient”: {
“requests”: {
“enable”: true
}
},
“serverless”: {
“functions”: [“createTicket”]
}
},
“engines”: {
“node”: “18.20.2”,
“fdk”: “9.4.2”
},
“dependencies”: {
“node-fetch”: “3.3.2”
}
}
2. server/server.js
const fetch = require(“node-fetch”);
const createTicket = async (args) => {
try {
const { phone, category, issue } = JSON.parse(args.body);
const response = await fetch("https://syntra.tmone.com.my/syntra/tmforce_v1/fdk/create_ticket.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ phone, category, issue }),
});
const result = await response.json();
return {
status: 200,
headers: { "Content-Type": "application/json" },
body: JSON.stringify(result),
};
} catch (error) {
return {
status: 500,
headers: { “Content-Type”: “application/json” },
body: JSON.stringify({ status: “error”, message: “Internal server error” }),
};
}
};
exports = {
createTicket,
};
3. Frontend JS (simplified)
client.request.invoke(“createTicket”, {
method: “POST”,
headers: {
“Content-Type”: “application/json”
},
body: JSON.stringify({ phone, issue, category })
});
Browser console error:
POST http://localhost:10001/dprouter?product=freshdesk 404 (Not Found)
Requested function ‘createTicket’ not found or registered
What I’ve Tried:
fdk validate
passes.
- Moved
server.js
in and out of the/server
folder. - Triple-checked function names and structure.
My Questions:
- Is
client.request.invoke("createTicket")
officially supported in Freshdesk custom apps on platform version 2.3? - If yes, what am I doing wrong?
Thanks in advance for any guidance.