Local invocation: LAMBDA_TASK_ROOT should point service root
#3,520 opened on 2017年4月26日
説明
This is a (Bug Report / Feature Proposal)
Feature
Description
I have some additional binaries to be included in PATH before executing my function. I am using LAMBDA_TASK_ROOT to get code dir and add it to PATH. Setting LAMBDA_TASK_ROOT in invoke local was added here: https://github.com/serverless/serverless/issues/2700, but it is hardcoded to /var/task. I would like to set LAMBDA_TASK_ROOT to my current code directory so that invoke local works for my code.
Changing https://github.com/serverless/serverless/blob/master/lib/plugins/aws/invokeLocal/index.js#L85 from LAMBDA_TASK_ROOT: '/var/task', to LAMBDA_TASK_ROOT: process.env.LAMBDA_TASK_ROOT || '/var/task', would be sufficient for me.
EDIT: For my particular use case, I just figured out that I can use __dirname in my handler.js to get the code dir, but I think the above proposal might still be useful.
For bug reports:
- What went wrong?
- What did you expect should have happened?
- What was the config you used?
- What stacktrace or error message from your provider did you see?
For feature proposals:
- What is the use case that should be solved. The more detail you describe this in the easier it is to understand for us.
- If there is additional config how would it look
Similar or dependent issues:
- #12345
Additional Data
- Serverless Framework Version you're using: 1.10.1
- Operating System: Ubuntu 16.10
- Stack Trace:
- Provider Error messages: