serverless-python-requirements
serverless-python-requirements copied to clipboard
bugfix: ENOENT error when packaging individually while none of the functions have a requirements file
This addresses issue https://github.com/serverless/serverless-python-requirements/issues/397
In 2019 @ComfyDust did an investigation into this and pinpointed it to the pip.js file, with a workaround that you can create an empty requirements.txt file in each function folder.
As of 2022, the workaround is creating a requirements.txt file in a single function folder, which creates the requirements directory and prevents an ENOENT.
This PR ensures that the function's requirements parent directory is created regardless of whether a requirements file exists.
In my testing this did not increase deployment times at all, and lets packaging "individually" work if no requirements files are in any folder.
Thanks @noxasaxon - I'm honestly not sure about the proposed solution - why do we actually have to create these directories if they're not needed? What part of the building process fails due to the dir not existing? Maybe that part should be fixed so it doesn't try to access anything from a directory that shouldn't even exist? Do you have a reproduction steps for this bug?
Hey @noxasaxon - there's no activity for a few months. I'm going to close this PR fow now, but feel free to come back and we can re-open it 💯 Thanks for your work 🙇
Hey sorry I forgot to report back!
I ended up making a new package that isn't a serverless plugin, because we wanted to make sure we could move to pulumi or something later. It uses your caching and conditional docker code, and adds some customizations for what I was trying to do.
https://github.com/twilio-labs/socless_lambda_packager
Hey @noxasaxon, thanks a lot for reporting back 🙇 I will check that out, maybe we can still incorporate it into the plugin. 💯