Hi team, is there any way to debug / troubleshoot ...
# hackathon-03-19-2020
g
Hi team, is there any way to debug / troubleshoot why my
pulumi up
command is “hanging”? It doesn’t look like anything is happening 😞
w
What language is it in?
g
Go
w
Hmm - nothing comes to mind in particular - verbose logs likely helpful - what do so see in output?
g
Hmm 🤔 I think I figured out what my problem is, and I have a sort of workaround but I’m not sure this is the best solution. I’m creating an API Gateway, using an API specification. To connect the gateway to the Lambda functions, I need to add an Integration. The integration needs the ID of the Resource and to do a LookupResource I need a raw string value of the API Gateway ID. To get that, I do
Copy code
c := make(chan string)
	gw.ID().ToStringOutput().ApplyString(func(id string) string {
		c <- id
		return id
	})

	restID := <-c
But during dry run, this won’t work because there is no ID yet and this is stops waiting for the channel. I think I can work around this by simply adding an if statement
Copy code
if !ctx.DryRun() {}
But I’m not sure that’s the correct option
any thoughts on this?
w
Oh - yeah - managing your own concurrency could definitely lead to hangs.
The integration needs the ID of the Resource and to do a LookupResource I need a raw string value of the API Gateway ID.
Can you do the
LookupResource
inside an
.Apply
?
g
I guess I could. I’d need to do a few lookups and make sure the data of the lookup will be available outside the Apply… let me try a few things 🙂
w
The idea should be (schematically):
Copy code
gateway = new Gateway();

new Integrattion({
   resource: gateway.id.apply(gatewayId => getResource(gatewayId)),
})
g
Works like a charm now 🙂 my apply function is a little big but it works like a well oiled machine. One service done, a few more to go before 5pm 😅