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

prehistoric-caravan-46299

04/08/2019, 7:15 PM
anyone know what this error is off the top of their head
Copy code
TSError: ⨯ Unable to compile TypeScript:
    index.ts(4,20): error TS2304: Cannot find name 'awsx'.
    index.ts(8,19): error TS2304: Cannot find name 'awsx'.
    index.ts(13,24): error TS2304: Cannot find name 'awsx'.
    index.ts(22,51): error TS7006: Parameter 'e' implicitly has an 'any' type
w

white-balloon-205

04/08/2019, 7:21 PM
Sounds like you are missing an
import * as awsx from "@pulumi/awsx"
at the top of your file?
p

prehistoric-caravan-46299

04/08/2019, 7:25 PM
of my .ts file?
w

white-balloon-205

04/08/2019, 7:25 PM
Yep.
p

prehistoric-caravan-46299

04/08/2019, 7:29 PM
slightly different now...
Copy code
pulumi:pulumi:Stack (container-quickstart-dev):
    Found incompatible versions of @pulumi/pulumi.  Differing major or minor versions are not supported.
      Version 0.16.19 referenced at node_modules/@pulumi/aws-infra/node_modules/@pulumi/pulumi/package.json
      Version 0.17.5 referenced at node_modules/@pulumi/pulumi/package.json

    error: Running program '/Users/sean/container-quickstart' failed with an unhandled exception:
    TSError: ⨯ Unable to compile TypeScript:
    index.ts(1,23): error TS2307: Cannot find module '@pulumi/awsx'.
    index.ts(23,51): error TS7006: Parameter 'e' implicitly has an 'any' type
well i figured it is missing that package all together...
@pulumi/awsx
install that and get another error
w

white-balloon-205

04/08/2019, 7:38 PM
Yes - you will need
npm intall @pulumi/awsx
to install the
awsx
package.
p

prehistoric-caravan-46299

04/08/2019, 7:41 PM
ok back to normal syntax erro``` index.ts(23,25): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'OutputInstance<ListenerEndpoint> & LiftedObject<ListenerEndpoint, "hostname" | "port">' has no compatible call signatures.``` I wonder if the ts file is just wrong here https://pulumi.io/quickstart/aws/tutorial-service.html
w

white-balloon-205

04/08/2019, 7:42 PM
Ahh - I was going to ask which tutorial you were following - cause it's clearly missing some steps! I'll open an issue to get that one fixed up.
cc @lemon-spoon-91807. I also opened up https://github.com/pulumi/docs/issues/981 to make sure we fix up this tutorial.
l

lemon-spoon-91807

04/08/2019, 7:46 PM
Indeed. apologies. this is on me
i can walk you through how to get past this if you'd like!
First off, I'm glad you figured out the
@pulumi/awsx
bit
the next bit is a change we made on this line ``export const hostname = listener.endpoint().apply(e =>
http://${e.hostname}
);``
it should be ``export const hostname = listener.endpoint.apply(e =>
http://${e.hostname}
);``
i.e. no parens after 'endpoint'
I've created PRs to fix up the docs here. Sorry for the pain!
Ok. fixes have gone in. The next time we regenerate our docs (hopefully soon), this will all be corrected
p

prehistoric-caravan-46299

04/08/2019, 8:46 PM
so would final script be like this->
Copy code
import * as awsx from "@pulumi/awsx"
// Create an elastic network listener to listen for requests and route them to the container.
// See <https://docs.aws.amazon.com/elasticloadbalancing/latest/network/introduction.html>
// for more details.
let listener = new awsx.elasticloadbalancingv2.NetworkListener("nginx", { port: 80 });

// Define the service to run.  We pass in the listener to hook up the network load balancer
// to the containers the service will launch.
let service = new awsx.ecs.FargateService("nginx", {
    desiredCount: 2,
    taskDefinitionArgs: {
        containers: {
            nginx: {
                image: awsx.ecs.Image.fromPath("./app"),
                memory: 512,
                portMappings: [listener],
            },
        },
    },
});

// export just the hostname property of the container frontend
export const hostname = listener.endpoint.apply(e => `http://${e.hostname}`);
b/c i retried with error error: Running program '/Users/sean/container-quickstart' failed with an unhandled exception: TSError: ⨯ Unable to compile TypeScript: index.ts(14,24): error TS2554: Expected 2 arguments, but got 1.
l

lemon-spoon-91807

04/08/2019, 8:51 PM
let me see 🙂
could you let me know what line that is?
oh, probably: awsx.ecs.Image.fromPath("./app"),
?
try changing to
...fromPath("nginx", "./app")
did that work @incalculable-sundown-82514
er... @prehistoric-caravan-46299
2 Views