Cloud function not working in local emulator [Firebase]

I am learning about cloud functions, the function HelloWorld works in the emulator but the updateUserRoleCron is not working, when I use “run npm serve” in the console this happens, thank you in advance. enter image description here

Function:

 exports.updateUserRoleCron = functions.pubsub.schedule('every 24 hours').onRun(async (context) => {
  const thresholdTimestamp = Date.now() - (30 * 24 * 60 * 60 * 1000); // Hace 30 días
  const usersRef = admin.firestore().collection('users');

  try {
    const snapshot = await usersRef.where('role', '==', 'subscriber').where('lastUpdate', '<=', thresholdTimestamp).get();

    const batch = admin.firestore().batch();

    snapshot.forEach(doc => {
      batch.update(doc.ref, { role: 'normal' });
    });

    await batch.commit();

    console.log('Roles de usuarios actualizados correctamente');
  } catch (error) {
    console.error('Error al actualizar los roles de usuario:', error);
  }
});

ran npm serve to load cloud functions in local but an error shows up