https://pulumi.com logo
#general
Title
# general
f

full-dress-10026

02/20/2019, 9:10 PM
These errors are a bit cryptic. Any idea why port
8880
would be invalid? It'd be much more helpful if the stack trace pointed to something in my code.
Copy code
error: Running program '/home/kenny/compute_software/infrastructure/pulumi-src' failed with an unhandled exception:
    error: Error: Invalid port: 8880
        at pulumi.all.apply (/home/kenny/compute_software/infrastructure/pulumi-src/node_modules/@pulumi/elasticloadbalancingv2/application.ts:142:28)
        at Output.<anonymous> (/home/kenny/compute_software/infrastructure/pulumi-src/node_modules/@pulumi/awsx/node_modules/@pulumi/pulumi/resource.js:277:47)
        at next (native)
        at /home/kenny/compute_software/infrastructure/pulumi-src/node_modules/@pulumi/awsx/node_modules/@pulumi/pulumi/resource.js:20:71
        at __awaiter (/home/kenny/compute_software/infrastructure/pulumi-src/node_modules/@pulumi/awsx/node_modules/@pulumi/pulumi/resource.js:16:12)
        at promise.then (/home/kenny/compute_software/infrastructure/pulumi-src/node_modules/@pulumi/awsx/node_modules/@pulumi/pulumi/resource.js:264:62)
    error: Running program '/home/kenny/compute_software/infrastructure/pulumi-src' failed with an unhandled exception:
    error: Error: Invalid port: 8880
        at pulumi.all.apply (/home/kenny/compute_software/infrastructure/pulumi-src/node_modules/@pulumi/elasticloadbalancingv2/application.ts:142:28)
        at Output.<anonymous> (/home/kenny/compute_software/infrastructure/pulumi-src/node_modules/@pulumi/awsx/node_modules/@pulumi/pulumi/resource.js:277:47)
        at next (native)
        at /home/kenny/compute_software/infrastructure/pulumi-src/node_modules/@pulumi/awsx/node_modules/@pulumi/pulumi/resource.js:20:71
        at __awaiter (/home/kenny/compute_software/infrastructure/pulumi-src/node_modules/@pulumi/awsx/node_modules/@pulumi/pulumi/resource.js:16:12)
        at promise.then (/home/kenny/compute_software/infrastructure/pulumi-src/node_modules/@pulumi/awsx/node_modules/@pulumi/pulumi/resource.js:264:62)
    error: an unhandled error occurred: Program exited with non-zero exit code: 1
This is how I'm creating my LB:
Copy code
let httpBackendSg = new awsx.ec2.SecurityGroup("http-backend-lb-sg", {
    vpc: cluster.vpc,
    ingress: [{
        protocol: "tcp",
        fromPort: 8880,
        toPort: 8880,
        cidrBlocks: ["0.0.0.0/0"]
    }],
    egress: [{
        protocol: "-1",
        fromPort: 0,
        toPort: 0,
        cidrBlocks: ["0.0.0.0/0"]
    }]
});

const httpBackendLb = new awsx.elasticloadbalancingv2.ApplicationLoadBalancer("http-backend-lb4", {
    vpc: vpc,
    external: true,
    securityGroups: [httpBackendSg],
});

const httpBackendTg = httpBackendLb.createTargetGroup("http-backend-tg3", {
    port: 8880,
    healthCheck: {
        protocol: "HTTP",
        path: "/_healthcheck",
        healthyThreshold: 2,
        unhealthyThreshold: 4,
        matcher: "200"
    }
});

const httpBackendListener = httpBackendTg.createListener("http-backend-listener2", {
    port: 8880
});
b

busy-umbrella-36067

02/20/2019, 10:06 PM
is it the security group? should be
httpBackendSg.id
also what is awsx? is that the non Terraform based aws provider?
f

full-dress-10026

02/20/2019, 10:08 PM
No. It's a different API: https://github.com/pulumi/pulumi-awsx
l

lemon-spoon-91807

02/20/2019, 10:08 PM
we need to know what protocol you want
we have code that does the following:
Copy code
switch (port) {
            case 80: case 8000: case 8008: case 8080: return <ApplicationProtocol>"HTTP";
            case 443: case 8443: return <ApplicationProtocol>"HTTPS";
            default: throw new Error("Invalid port: " + JSON.stringify(port));
        }
You're right that the error message should be clearer.
in the meantime, you can solve this by manually providing a protocol.
f

full-dress-10026

02/20/2019, 10:11 PM
Is there a reason it shouldn't always be HTTP if the port isn't 443 or 8443?
Unless overridden by the user...
l

lemon-spoon-91807

02/20/2019, 10:12 PM
doesn't seem like there's a reason we would believe an arbitrary port would be HTTP
it seems just as likely to be HTTPS afaict.
Let me update the error message though
f

full-dress-10026

02/20/2019, 10:13 PM
Fair enough
l

lemon-spoon-91807

02/20/2019, 10:17 PM
2 Views