Google Apps Script Form submission event object (e) is undefined

I need to create a form that can delete dates and hours that have already been booked. I’m using Google Forms and Google Apps Script. Although I’ve set up triggers on both the Google Sheets and Google Forms, I’m encountering an issue with onFormSubmit(e) where ‘e’ is undefined. What am I doing wrong? Below is the code I’m currently using.

function onFormSubmit(e) {
    try {
        const formId = 'notRealId';
        const form = FormApp.openById(formId);

 const sheet = SpreadsheetApp.getActiveSpreadsheet();
        const optionsSheet = sheet.getSheetByName('ANSWERS');
        if (!optionsSheet) throw new Error('Sheet 'ANSWERS' not found');
        }
   const responses = e.values;  // Fetch form submission values array
        const date = responses[2];
        const time = responses[3];
// Ensure date and time values are valid before processing further
        if (!date || !time) {
            throw new Error('Date or time values are missing or undefined.');
        }
    `// Remove date and time option from form`
 removeOptionFromForm(form, date, time);
    } catch (error) {
        console.error('Error in onFormSubmit function:', error.message);
    }}
function removeOptionFromForm(form, date, time) {
    try {
        const dateItem = form.getItems(FormApp.ItemType.DATE)[0];
        const timeItem = form.getItems(FormApp.ItemType.LIST)[1];

if (!dateItem || !timeItem) {
            throw new Error('Date or time question not found in the form');
        }
 const dateChoices = dateItem.asDateItem().getChoices();
        const timeChoices = timeItem.asListItem().getChoices();
    // Find and remove selected date
    
for (let i = 0; i < dateChoices.length; i++) {
            if (dateChoices[i].getValue().getTime() ===
                new Date(date).getTime()) {
                dateChoices.splice(i, 1);break;

     }
        }

// Find and remove selected time

   for (let i = 0; i < timeChoices.length; i++) {
            if (timeChoices[i].getValue() === time) {
                timeChoices.splice(i, 1);break;
            }}
  `  // Update form with modified choices`
    
dateItem.asDateItem().setChoiceValues(
            dateChoices.map(choice => choice.getValue()));
        timeItem.asListItem().setChoiceValues(
            timeChoices.map(choice => choice.getValue()));


      console.log('Options updated successfully.');
    } catch (error) {
        console.error('Error in removeOptionFromForm function:', error.message);
    }}