node-XMLHttpRequest icon indicating copy to clipboard operation
node-XMLHttpRequest copied to clipboard

Write temp files to /tmp

Open barodeur opened this issue 7 years ago • 5 comments

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.

barodeur avatar Jan 18 '18 08:01 barodeur

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.

demsey2 avatar Jan 18 '18 08:01 demsey2

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?

barodeur avatar Jan 18 '18 08:01 barodeur

you need that fix for AWS Lambda for Google Functions you need more changes

demsey2 avatar Jan 18 '18 08:01 demsey2

Thanks for the clarification

barodeur avatar Jan 18 '18 09:01 barodeur

checkout https://www.npmjs.com/package/xmlhttprequest-ts - i added your pull request

hmoog avatar Jun 13 '18 15:06 hmoog