I'm trying to build a pex_binary for aws lambda on...
# general
a
I'm trying to build a pex_binary for aws lambda on a MacOS machine. Accordingly, I'm using a docker_environment to deal with dependencies.
Copy code
docker_environment(
    name="aws_lambda_python39",
    platform="linux_x86_64",
    image="public.ecr.aws/lambda/python:3.9",
)
Copy code
pex_binary(
    name="flagger",
    layout="zipapp",
    inherit_path="fallback",
    dependencies=["src/dz/anomaly_flagger/handler.py"],
    environment="aws_lambda_python39",
)
pants package is failing with
Failed to create Docker execution in container: RequestTimeoutError
I am able to to
docker run --platform=linux/x86_64 public.ecr.aws/lambda/python:3.9
on the machine, and I've got no clue what request is timing out, nor why. Any idea how to proceed?
poking @fast-belgium-77939 in case it's all his fault
🙉 1
f
tl;dr — it wasn’t my fault (yet), but we are occasionally seeing some weird behavior that may or may not be related to different macos x docker versions. We are highly confused, more on this hopefully once we find a way to consistently reproduce the issue. One very weird bugs that we are instead consistently seeing seems to be that
pants
cannot pull
public.ecr.aws/lambda/python:3.9
when preparing a
docker_environment
target, throwing the following error:
Copy code
Error: 2.64 [ERROR] 1 Exception encountered:

Engine traceback:
  in `package` goal
  in Building local distributions - environment:aws_lambda_python39

Exception: Failed to pull image `public.ecr.aws/lambda/python:3.9`: Failed to pull Docker image `public.ecr.aws/lambda/python:3.9`: Failed to retrieve credentials for server `public.ecr.aws`: User has no credential configured
Running
docker pull --platform linux/amd64 public.ecr.aws/lambda/python:3.9
before
pants package
fixes the issue, so clearly there’s some login shenanigans that might be going wrong?
e
(Adjusting those instructions for ~same on
docker_environment
.)
w
support for credential helpers in
docker_environment
was added in https://github.com/pantsbuild/pants/pull/18541, but i wouldn’t be surprised if there are still issues there. if you can file a repro i can take a look.
f
Thank you both — I’ll take a look (and shame on me for missing that bit in the docs 😓 )
a
Do you know what versions of Pants I can get https://github.com/pantsbuild/pants/pull/18541?
w
looking at release changelogs will usually get you that answer. one sec.
a
thanks! It appears that Github's
HOME
injection for containerized jobs (or whatever it's doing) is making Pants unable to find the docker config file.
Copy code
DOCKER_CONFIG=%(homedir)s/.docker
did not resolve properly but a hardcoded
Copy code
DOCKER_CONFIG=/github/home/.docker
seems to be working. I'm hoping that release candidate fixes the issue so I don't need to hardcode things, will update 🤞
w
that… sounds like a separate issue from anything to do with credential helpers, probably? but yea, if not: please file an issue
a
Ah, yeah, I seem to be confused how that works. Upgrading to the release candidate did not work