I think what you are doing is an overkill tbh. Google provides a nice little wrapper around their APIs via Google Apps Script, which allows you to use JS to interact directly without much overhead. You can use a JS eml parser [1] for this convert it into a single file dependency using esbuild [2], which will allow you to easily work inside the App Script environment
[1]: https://www.npmjs.com/package/eml-parser [2]: https://stackoverflow.com/a/68379707/9496502