Hey friends. I'm trying to use pants to bundle a ...
# general
a
Hey friends. I'm trying to use pants to bundle a lambda function as a pex binary, following the advice in this issue about the retirement of
lambdex
. I've uploaded the pex to lambda, and the handler is invoked correctly, but it's unable to resolve
boto3
, which should be present by default in the lambda runtime. My guess is that pants' sys path magic is preventing it from resolving. Any clues?
1
Disregard that - fixed by inheriting the path. Thanks for 🦆
👍 1
e
Did you do that with a build time option or by setting
PEX_INHERIT_PATH=x
in the lambda environment?
a
The former
e
Ok, you can do the latter as well in case you weren't aware - say you generally want hermeticity in your PEX but only want to let the env leak in in very particular use cases. All the knobs like this are here: https://pex.readthedocs.io/en/v2.1.125/api/vars.html or
pex --help-variables
a
Thanks! I'll do some reading, I'm interested in the implications of PEX_ROOT. atm I get a warning that the directory is non-writeable
e
On AWS Lambda you want
PEX_ROOT=/tmp
👍 1
That's the only portion of the fs that can be written IIRC.
a
Yes, that's correct
e
You can also set that one at build time with
--runtime-pex-root
.