Using StructuredOutput module on Linux AWS Lambda

How to get the StructuredOutput (for PDF to Office/HTML conversion) to work on AWS Lambda?

If you are get an error like the one below, then the issue is that the StructuredOutput module requires a HOME directory, which lambdas do not have.

You can bypass this requirement by adding HOME to the process environment variables and pointing it to a writable directory. After doing this the module should work.

  message: 'Exception: \n' +
    '\t Message: An Internal Error occurred.\n' +
    '\t Conditional expression: exit_code == 0\n' +
    '\t Version      : 9.4.0-29d3f4d\n' +
    '\t Platform     : Linux\n' +
    '\t Architecture : AMD64\n' +
    '\t Filename     : SolidStructuredOutput.cpp\n' +
    '\t Function     : DoConvert\n' +
    '\t Linenumber   : 698\n',
  type: 'PDFWorkerError'