Admin API Update Looping Through Posts

I’m using the Admin API to update the primary_user and primary_tag for posts which have a certain custom_template.

const updatePost = (post_id) => {
    api.posts.edit({ id: post_id, primary_tag: '5ff4d52e63ddfc00012e7d9f', primary_author: 1, updated_at: new Date() })
        .then(response => console.log(response))
        .catch(error => console.error(error));
}

api.posts.browse({limit: 50})
    .then(responses => {
        responses.forEach(response => {
            if(response.custom_template == 'custom-photo') {
                updatePost(response.id)                
            }
        })
    })
    .catch(error => console.error(error))

updatePost returns the posts but the primary_user and primary_tag fields remain null. I was able do perform the edit on a single post using api.posts.read({id: 'abcd1234'}) but something about this loop isn’t working.