So, i’m developing an application that connects to an external API via oauth.
I’m using a recurring schedule to keep the data synchronized between the external API and the local db (in FD)
I’ve created an iparams.html file for finetuned control for the end-user.
This settings-page works perfectly on local-testing
However, I could not get it to install without errors. By breaking the application apart, I’ve managed to find the culprit; I cannot set the schedule.
I’ve created a SMI-function in server.js:
setUpSchedule: function(args){
console.log(args)
let dateString = args.date
$schedule.create({
name: "bedrijfsrooster",
data: {recurring:true},
schedule_at: dateString,
repeat: {
time_unit: "minutes",
frequency: 5
}
}).then(function(data) {
renderData(null,data)
}, function(error){
renderData(error)
})
}
I’m calling this SMI-function from a function in iparams.js:
function setUpScheduleSmi(){
let date = Date.now();
let dateString = new Date(date+(10*60000)).toISOString();
let options = {"date":dateString};
let button = document.getElementById('scheduleButton')
client.request.invoke("setUpSchedule",options).then(
function(data) {
button.classList.toggle("btn-default");
button.classList.toggle("btn-success")
console.log(data);
}, function(error) {
button.classList.toggle("btn-default");
button.classList.toggle("btn-danger");
console.log(error);
}
)
}
this is the options object that’s being sent:
{ date: '2021-10-13T08:57:39.908Z', iparams: { __meta: { secure: [Array] }, api_key: '***********', domain: '***' }, isInstall: false, account_id: *******, region: 'EUC' }
I get the following error:
frontend:
errorSource: "APP"
message: "Schedule event could not be created"
requestID: "9587c2eb-b7f6-45b1-bda9-49f6e1a68687"
status: 400
I hope anyone can shed some light on the cause of this error.