Great article Ali Hussam, lot of learning. Here's a question, instead of passing the image as base64 from caller service as interpolation payload. Can we store the images in some DB and then load them from inside the pupeeter service when actually generating and interpolating the PDF? This will also potentially reduce the debt of 10MB data limit for cloud functions
Very well written Ali Hussam! I have some questions/suggestions about the image loading part and the architecture. Hope it will help.
If the caller service has to pass the image data then does it already have a puppeteer-like implementation that fetches webpages and then the image data?
Generally the size of all the images combined is equivalent to the webpage size, Is there any reason why the entire webpage is sent as an event to another processor? Saving it into a blob and passing the address can be a better alternative.
One can use node streams to write data into storage. Instead of converting the entire file to PDF, saving it to memory, and then storing it. Chunks of data can be converted and written into storage using (createPDFStream). With this, a large number of files can be associated for conversion and even a considerably smaller worker (with smaller mem and power) can process all the files