Are random auth errors / closed sockets / indeterm...
# getting-started
m
Are random auth errors / closed sockets / indeterministic behavior just an expected thing with the Pulumi NodeJS SDK or?
b
Absolutely not. Do you have repros? Please file bugs
m
I have an eerie feeling I am doing something really obvious really wrong. I've used Terraform/Chef/Ansible/Helm/etc at scale, for years so the whole IaC bbq is not a new concept to me. With pulumi I can't even upload a docker image to a registry (constant auth errors, constant docker build errors, constant socket closed errors - all random) and put it onto an ECS EC2 service (no logs in aws, pulumi up hangs and when I check the AWS CLI status its just spam redeploying failed tasks)
I can share source here if you want
b
Yea please do. It’s obviously the weekend but will try take a look tomorrow
m
I guess one thing at a time - for docker, this code is: a) non-deterministic b) constant random auth errors c) constant random build errors
Copy code
const ecrRepository = new aws.ecr.Repository("pmb-main", { name: "pmb-main-ecr" });
const dockerImage = new docker.Image("pmb-main", {
    build: {
        args: {
            BUILDKIT_INLINE_CACHE: "1",
        },
        builderVersion: "BuilderBuildKit",
        cacheFrom: {
            images: [pulumi.interpolate(`${ecrRepository.repositoryUrl}:latest`)],
        },
        platform: "linux/amd64",
        context: "../../",
        dockerfile: "../../.cicd/imageFiles/Dockerfile",
    },
    imageName: pulumi.interpolate(`${ecrRepository.repositoryUrl}:latest`),
    registry: {
        password: pulumi.secret(aws.ecr.getAuthorizationTokenOutput({
            registryId: ecrRepository.registryId,
        }).apply(authToken => authToken.password)),
        server: ecrRepository.repositoryUrl,
    }
});
Even after manually logging into ECR with AWS CLI, it still gives auth errors lol
b
What error messages do you get?
m
Copy code
Type                   Name             Status                  Info
     pulumi:pulumi:Stack    pmb-development  **failed**              1 error
 +   └─ docker:index:Image  pmb-main         **creating failed**     1 error; 2 warnings


Diagnostics:
  pulumi:pulumi:Stack (pmb-development):
    error: update failed

  docker:index:Image (pmb-main):
    warning: username was not set, although password was; using host credentials file
    warning: username was not set, although password was; using host credentials file
    error: unauthorized: incorrect username or password
^ I see this even after manual AWS CLI login
oddly enough, i've tried the same with awsx.ecr.Repository and i get the same random behavior
Copy code
const ecrRepository = new awsx.ecr.Repository("pmb-main", { name: "pmb-main-ecr" });
const dockerImage = new docker.Image("pmb-main", {
    build: {
        args: {
            BUILDKIT_INLINE_CACHE: "1"
        },
        platform: "linux/amd64",
        builderVersion: "BuilderBuildKit",
        cacheFrom: {
            images: [pulumi.interpolate(`${ecrRepository.url}:latest`)],
        },
        context: "../../",
        dockerfile: "../../.cicd/imageFiles/Dockerfile",
    },
    imageName: pulumi.interpolate(`${ecrRepository.url}:latest`),
    registry: {
        password: pulumi.secret(aws.ecr.getAuthorizationTokenOutput({
            registryId: ecrRepository.registryId,
        }).apply(authToken => authToken.password)),
        server: ecrRepository.url,
    }
});
but anyways, its the weekend! thank you for replying - hopefully you've got some time on Monda6y
Heads up, after digging through source maps and debugging a bunch of other stuff... it seems that:
Copy code
pulumi.interpolate`${ecrRepository.url}:latest`
and:
Copy code
pulumi.interpolate(`${ecrRepository.url}:latest`)
Are not the same at all - for me personally, I would expect them to behave the same. Not sure if some directive/preamble parser or promise resolver is mucking things up down the line, but this accounts for the non-deterministic behavior of awsx.ecr.Repository + docker.Image πŸ™‚ working on debugging the rest.
b
@magnificent-soccer-44287 just to confirm, this fixed your issue?
m
@billowy-army-68599 this resolved instability around the docker image and ECR. I want to be sure on the rest of the stuff before I waste your time with what I think is a bug when i'm just not using the provided tools correctly
q
Out of curiosity and also not wanting to waste anyone's time: why would two interpolation syntaxes differ in behaviour in JS?
m
^ not sure...
@billowy-army-68599, confirmed another bug it seems: in "docker.Image" (nodejs v 4.4.1) when this is enabled:
Copy code
// cacheFrom: {
        //     images: [pulumi.interpolate`${pmbMainEcr.url}:latest`],
        // },
I repeatedly get:
Copy code
docker:index:Image (pmb-main):
    error: could not open dockerfile at relative path Dockerfile: stat Dockerfile: no such file or directory
commenting it out, running preview once, and re-enabling it fixes the issue
Unfortunately I don't have the best steps to reproduce as to how it got in that state