AWS Layer gives EPIPE error

Following is the serverless version that I am using

Framework Core: 1.77.1
Plugin: 3.6.18
SDK: 2.3.1
Components: 2.33.1

I followed the blog post and to create a html to pdf solution for my lambda…
I declared all the variables as exactly as given on the blog post…
But still i get

    "errno": "EPIPE",
    "code": "EPIPE",
    "syscall": "write"

the code runs in local though.