postman.getResponseCookie("csrftoken").value undefined

So not really sure how you’re generating that cookie in your code, Postman wouldn’t be creating that for you.

That image shows that for that particular request, there were no cookies in the response. Being that there are no cookies that script is failing before there’s nothing defined at that reference.