TypeError: Cannot read properties of undefined (reading 'afterSave')

this error happens in the database logs of cloud function

That error usually means that the variable before .afterSave is undefined

what an i gonna do so it would work out

Try with some simpler code, I don’t know why you get that error

Double check the syntax for afterSave