Scheduled Events Issue (Internal Server Error 500)

Hi Team,

Greetings!

I’m encountering an issue with scheduled events where I’m trying to perform two actions on a button click: creating a schedule and saving a record in the database.

The issue arises with the scheduled event, which is throwing an “Internal Server Error” with status code 500.

I tested the same zip file on another instance, and it works fine. However, I’m unable to identify the cause of the different behaviors across the two instances.

I’ve attached the HAR files for both instances. Kindly assist us in resolving this issue and moving forward.

Error Instance: spritlesaaslytoppings.freshdesk.com.har (154.8 KB)
Working Instance: spritlesoftware.freshdesk.com.har (230.7 KB)

Hi Team,

Are there any updates.

Hi @CommunityhelperforF1 ,

Are there any updates

Thanks
Anish

Hey @Anish,
Can you share the snippet of code where you are trying to create the schedule?

Sure @zach_jones_noel ,

manifest.json

{
  "platform-version": "3.0",
  "dependencies": {
    "lz-string": "1.5.0"
  },

  "modules": {
    "common": {
      "requests": {
        "fdAuthenticate": {},
        "getConversation": {},
        "createFDReply": {},
        "getTicket": {},
        "createTicketTag": {}
      },
      "events": {
        "onScheduledEvent": {
          "handler": "onScheduledEventHandler"
        }
      },
      "functions": {
        "createScheduler": {
          "timeout": 20
        },
        "deleteSchedular": {
          "timeout": 20
        }
      }
    },
    "support_ticket": {
      "location": {
        "ticket_sidebar": {
          "url": "index.html",
          "icon": "icon.svg"
        }
      }
    }
  },
  "engines": {
    "node": "18.13.0",
    "fdk": "9.1.3"
  }
}

Modal.js

     await client.request
            .invoke("createScheduler", {
              values,
            })
            .then(
              function (data) {
                if (data?.response?.data?.Created === true) {
                  client.instance.send({
                    message: { message: "Created" },
                  });
                  closeScheduleModal();
                }
                if (data?.response?.error) {
                  console.error("error ----->", data?.response?.error);
                  });
                }
              },
              function (error) {
                console.error("schedule create error ---->", error);

              }
            );

server.js

  createScheduler: async function (payload) {
    try {
      const values = payload?.values;

      const jsonString = JSON.stringify(values);

      // Compress the JSON string
      const compressedValues = LZString.compress(jsonString);

      let data = await $schedule.create({
        name: values?.ticketId?.toString(),
        data: { value: compressedValues },
        schedule_at: values?.followUpAt,
      });

      console.log("createScheduler >> data >>", data);

      renderData(null, { data: saveinDb });
    } catch (error) {
      renderData(null, { error: error });
      console.error("Schedule Create Error >>", error);
    }
  },

Kindly find the above snipet and also included the manifest file

Hope this helps…

Hi @zach_jones_noel ,

Are there any updates?