How do I solve a var.map is not a function TypeError?

Those logs tell the story, something is injecting an extra / into the request path :stuck_out_tongue: and your request structure is wrong, specifically the posts?&_sort

There should be no & after the ?