Internal server issue after installation of the app

After installing the program, I am getting a 500 error code, which is related to an internal server problem. There could be a scheduler problem to blame. On the other hand, my Middleware Visual Studio code is functioning properly. Need assistance in resolving the problem

Hey @Harshvitha_M,
Is this an error on the installation of FDK or the app? Can you also help with a error logs or screenshots?

Hi @jones ,
This is an error am facing post the installation of the app. When i try the same code in my middleware its working fine, but in app it does not work

Hi @zach_jones_noel

I am curious about this because I faced a similar error earlier. You can read more about the issue here.

Hey @Harshvitha_M,
Can you share the snippet of code, for creating the schedule? Please mask any sensitive data.

Hey @Kithiyon,
Please share if you have were able to resolve this.

hey @zach_jones_noel

Here is the snippet of the code

onAppInstallCallback: async function () {
console.log(“App Installed…”, new Date());
const nextScheduleDate = new Date(${new Date().toISOString().split('T')[0]}T01:00:00Z);
console.log(Next Sync is scheduled to run on ${nextScheduleDate});

try {
  console.log('fetching the existing record...');
  const isScheduleExist = await $schedule.fetch({ name: CISCO_DUO_SHCEDULED_NAME });
  console.log('Is Schedule Exists? ', isScheduleExist);
  if (!isScheduleExist) {
    await $schedule.create({
      name: CISCO_DUO_SHCEDULED_NAME,
      data: {},
      schedule_at: nextScheduleDate.toISOString(),
      repeat: {
        frequency: 24,
        time_unit: "hours"
      },
      
    });
  } else {
    await $schedule.update({
      name: CISCO_DUO_SHCEDULED_NAME,
      data: {},
      schedule_at: nextScheduleDate.toISOString(),
      repeat: {
        frequency: 24,
        time_unit: "hours"
      },
     
    })
  }

  console.log(`Next Sync is scheduled to run on ${nextScheduleDate}`);
} catch (error) {
  console.error('Error scheduling... ', error)
}

renderData();

},

@zach_jones_noel I didn’t find the solution for this because I faced this issue while testing our app as a custom app because the same version of this app is working well on production(market place). I just want to know the reason behind this error.

Hello @Harshvitha_M
You are trying to create a scheduler during the installation of the app. So there is no chance for an existing scheduler, so you don’t need to check for an existing scheduler.

Am I correct? @zach_jones_noel

@zach_jones_noel,

Yes, i ran my schedule in my virtual machine. It was running fine but not in my freshworks environment

Hi @Harshvitha_M,
As @Kithiyon mentioned, you don’t have to check for existing schedules for on app install. The recommended practice is - onAppInstall, create the schedule and onAppUninstall, delete the schedule

Can you try with constructing the ISO datetime string as below -

let scheduleDate = new Date()
scheduleDate.setHours(1,0,0,0)

await $schedule.create({
      name: CISCO_DUO_SHCEDULED_NAME,
      data: {},
      schedule_at: scheduleDate.toISOString(),
      repeat: {
        frequency: 24,
        time_unit: "hours"
      },
    });

Also to confirm is this on Platform version 2.3 or 3.0?

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