When our team tried to use tinify into a AWS Lambda function using Typescript the file node_modules/tinify/lib/data/cacert.pem
wasn't copied properly so the transpiled code could not find it and Tinify would fail.
Thanks to @shannonhochkins and his postinstall idea to inject the value of cacert.pem into Client.js.
- Create a
scripts/
folder on your project. - Create a file called
tinify-inject-cacertpem.js
inside thescripts/
folder.