Hi all. I have two problem with serverless app for freshteam.
Simple app:
manifest.json
{ "platform-version": "2.0", "product": { "freshteam": {} }, "dependencies": { "axios": "0.21.1" }, "whitelisted-domains": [ "https://*.freshteam.com", "http://[REDACTED].jooble.org", "https://[REDACTED].jooble.org" ] }
server.js
var axios = require("axios"); axios.defaults.headers.post["Content-Type"] = "application/json; charset=utf-8"; exports = { events: [ { event: "onAppUninstall", callback: "onAppUninstallHandler" }, { event: "onJobPostingCreate", callback: "onJobPostingCreateHandler" }, { event: "onJobPostingUpdate", callback: "onJobPostingUpdateHandler" } ], onAppUninstallHandler: function (args) { var data = { domain: args.domain }; HandleData("/Freshteam/AppUninstall", data); }, onJobPostingCreateHandler: function (args) { if (args.data.jobposting.status === "published") { var data = { domain: args.domain, title: args.data.jobposting.title, description: args.data.jobposting.description, region: `${args.data.associations.branch.city}, ${args.data.associations.branch.country_code}`, job_type: args.data.jobposting.type, salary: `${args.data.jobposting.salary.min} - ${args.data.jobposting.salary.max}, ${args.data.jobposting.salary.currency}`, remote: args.data.jobposting.remote, date_posted: args.data.jobposting.created_at, date_expire: args.data.jobposting.closing_date, apply_url: args.data.jobposting.applicant_apply_link }; HandleData("/Freshteam/JobPosted", data); } else renderData(); }, onJobPostingUpdateHandler: function (args) { var data = { domain: args.domain, is_deleted: args.data.jobposting.deleted, apply_url: args.data.jobposting.applicant_apply_link, changes: args.changes.model_changes } HandleData("/Freshteam/JobUpdate", data); } }; function HandleData(endpoint, data) { axios.post(`http://[REDACTED].jooble.org${endpoint}`, data) .then(function (response) { renderData(response); }) .catch(function (error) { renderData(error); }); }
Problem one:
- When in the simulator http://localhost:10001/web/test# I press appUninstall\appInstall → Simulate , there are no errors in the console window and everything works fine.
- But next I select onJobPostingCreate → Simulate, everything is done i receive data in api project, it shows Success and I get an error in the console in the screenshot below.
Perhaps this is a local problem and not a problem on the portal.
Problem two:
- Uploaded custom app in https://www.freshdev.io/
- When i try install app in freshteam portal, I get an error (Cannot read property ‘extDetail’ of undefined) in screenshot below I didn’t find it in the tech documentation about this property
- I tried to create an empty app, uploaded it as an integrator, we try to install it, everything worked out, I try to delete it, I get an same error in the screenshot below.