node-XMLHttpRequest
node-XMLHttpRequest copied to clipboard
Write temp files to /tmp
As suggested by @lucabarze in https://github.com/driverdan/node-XMLHttpRequest/issues/145 this fix should fix the problem we have when using sync requests on AWS Lambda.
I tried that with AWS Lambda and it works fine, however, my initial issue was with Google Cloud Function. The introduced changed in this PR doesn't work. I believe the main problem is with a different approach to the /tmp directory in GCF. According to their docs "Cloud Functions provides access to a local disk mount point (/tmp) which is known as a "tmpfs" volume in which data written to the volume is stored in memory.". So when we create syncFile in the parent process and then we try to unlink in the child process, it doesn't work the file doesn't exist. So we end up with an infinite loop caused by the while loop.
I managed to fix that by calling spawnSync to check if syncFile exists in the child process.
Sorry to hear this doesn't help you. Do you confirm that node-XMLHttpRequest works with Lambda without this fix? Should I close this pull request?
you need that fix for AWS Lambda for Google Functions you need more changes
Thanks for the clarification
checkout https://www.npmjs.com/package/xmlhttprequest-ts - i added your pull request