Cannot read properties of undefined (reading 'map')
map was called on a value the response never included. Default to an array before you iterate.
Solutions
The message, why it happens, and the corrected code. Three opening solutions.
map was called on a value the response never included. Default to an array before you iterate.
Output started before header() or a redirect. Move the redirect above any echo, and close the file without a trailing gap.
The remote has commits you do not have. Pull with rebase, or merge, then push. Do not force-push a shared branch.