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

brave-angle-33257

10/23/2019, 6:50 PM
running into issue here:
Copy code
error: Running program '/data/pulumi/infra/aws/company/company-step-functions' failed with an unhandled exception:
   TSError: ⨯ Unable to compile TypeScript:
   index.ts(53,5): error TS2322: Type 'Output<string>' is not assignable to type 'Input<Topic>'.
code is:
Copy code
const success_topic_subscription_name = `${company}-collector-${env}-success-email`
const success_topic_subscription = new aws.sns.TopicSubscription(success_topic_subscription_name, {
    endpoint: "<https://global.sns-api.chatbot.amazonaws.com>",
    protocol: "HTTPS",
    topic: success_topic.arn,
});
in docs shows that string is OK
Copy code
const userUpdatesSqsTarget = new aws.sns.TopicSubscription("userUpdatesSqsTarget", {
    endpoint: "arn:aws:sqs:us-west-2:432981146916:queue-too",
    protocol: "sqs",
    topic: "arn:aws:sns:us-west-2:432981146916:user-updates-topic",
});
h

handsome-actor-1155

10/23/2019, 6:58 PM
How are you getting the variable
success_topic
?
b

brave-angle-33257

10/23/2019, 7:01 PM
getting it, one sec
Copy code
const success_topic = new aws.sns.Topic("success_topic", {
    name: topic_success_name`,
});
shouldnt we be able to pass in a string of ARN also? we’ve tried that also, same error
wont take a string
h

handsome-actor-1155

10/23/2019, 7:06 PM
You're saying that it won't take that actual string either?
b

brave-angle-33257

10/23/2019, 7:06 PM
wont take an arn string, let me verify
h

handsome-actor-1155

10/23/2019, 7:08 PM
Try explicitly setting
success_topic
as type
Topic
Copy code
const success_topic: Topic = new aws.sns.Topic("success_topic", {
    name: topic_success_name`,
});
You may need to fully qualify with
aws.sns.Topic
b

brave-angle-33257

10/23/2019, 7:13 PM
ok let me try that in a sec
here’s a full example
Copy code
const topic_success_name = `success2`
const success_topic = new aws.sns.Topic(topic_success_name, {
    name: topic_success_name
});

const success_topic_subscription_name = `success-email2`
const success_topic_subscription = new aws.sns.TopicSubscription(success_topic_subscription_name, {
    endpoint: "<https://global.sns-api.chatbot.amazonaws.com>",
    protocol: "HTTPS",
    topic: success_topic.arn
});
the auto complete gives an error on topic, saying same thing about it needs Input Topic
running this ^
gives:
Copy code
`    error: Running program '/data/pulumi/infra/aws/company/company-step-functions' failed with an unhandled exception:
    TSError: ⨯ Unable to compile TypeScript:
    index.ts(48,5): error TS2322: Type 'Output<string>' is not assignable to type 'Input<Topic>'.
      Type 'Output<string>' is not assignable to type 'OutputInstance<Topic>'.
        Types of property 'apply' are incompatible.
          Type '{ <U>(func: (t: string) => Promise<U>): Output<U>; <U>(func: (t: string) => OutputInstance<U>): Output<U>; <U>(func: (t: string) => U): Output<U>; }' is not assignable to type '{ <U>(func: (t: Topic) => Promise<U>): Output<U>; <U>(func: (t: Topic) => OutputInstance<U>): Output<U>; <U>(func: (t: Topic) => U): Output<U>; }'.
            Types of parameters 'func' and 'func' are incompatible.
              Types of parameters 't' and 't' are incompatible.
                Type 'string' is not assignable to type 'Topic'.
this does not work:
Copy code
const success_topic:aws.sns.Topic = new aws.sns.Topic(topic_success_name, {
    name: topic_success_name
});
same error
this passes syntax check:
Copy code
const topic_success_name = `success2`
const success_topic = new aws.sns.Topic(topic_success_name, {
    name: topic_success_name
});

const success_topic_subscription_name = `success-email2`
const success_topic_subscription = new aws.sns.TopicSubscription(success_topic_subscription_name, {
    endpoint: "<https://global.sns-api.chatbot.amazonaws.com>",
    protocol: "HTTPS",
    topic: success_topic
});
but dies on create
Copy code
$ pulumi version
v1.3.4
Copy code
$ pulumi plugin ls
NAME   KIND      VERSION  SIZE    INSTALLED  LAST USED
aws    resource  1.6.0    220 MB  n/a        11 minutes ago
h

handsome-actor-1155

10/23/2019, 7:24 PM
hmm
removing the
arn
part works for me
nvm got the error too
b

brave-angle-33257

10/23/2019, 7:28 PM
h

handsome-actor-1155

10/23/2019, 7:28 PM
That's what I was gonna suggest
b

brave-angle-33257

10/23/2019, 7:29 PM
yea, just seems like a lil’ bug somewhere
alrighty, we’ll continue on best we can in the meantime
thanks for your help and confirmation 👍
h

handsome-actor-1155

10/23/2019, 7:30 PM
Sure thing. I just so happened to have a pulumi aws infra project open so was easy to reproduce 🙂