But it doesn’t seem to suggest a solution.
# automation-api
m
But it doesn’t seem to suggest a solution.
l
Are you able to set config on the stack as a part of your automation API program as suggested in this workaround? https://github.com/pulumi/pulumi-aws/issues/1692#issuecomment-985302858
aws:skipMetadataApiCheck false
m
So you set that as a config?
I didn’t know that’s how it was supposed to be implemented - I’ll try that thanks
Hi @lemon-agent-27707 thanks for pointing this out - much appreciated. This seems to work great but I ran into another issue. When I just return a
res.json({ success: true})
from my express server, it returns fine, but when using Pulumi Automation, I get
upstream request timeout
as a response with 504 error code even though the stack update has been completed successfully.
Copy code
const upRes = await stack.up({ onOutput: <http://console.info|console.info> })
    console.log('stack upRes', upRes)
    res.json({
      outputs: upRes.outputs,
    })
upRes consoles out fine, but in the browser, I get 504 error back with
upstream request timeout
Have you seen this before?
l
A stack update can take quite a long time, often longer than an http request timeout.
My guess is that you'll have to change your API to be async. Your API will kick off the update in a separate process and then Implement handlers that allow polling for status.
m
Right - that makes sense. But just so I get this right, this particular one I’m running is a simple secret saving in AWS secrets manager and the process says it completes in 2s. So I think it’s not really a request timeout issue?
Hi @lemon-agent-27707 any thoughts on this?
l
I wonder if there is an issue deserializing outputs. Maybe try lifting the value you want out of outputs as we do in the example I linked.
m
Oh so rather than returning the
upRest.outputs
, return values inside it? I’ll try that
OK that was not the issue but I figured it out - turns out that Emissary Ingress (ingress into our Kubernetes cluster) has a default timeout of 3 seconds (which seems surprisingly short). I changed it to 1 min and now it’s working!
Thanks a lot for your help @lemon-agent-27707 !
👍 1
Hi @lemon-agent-27707 sorry one more quick question - this is not specific to Pulumi perhaps, but creating an EKS stack in my case can take up to an hour. So I was wondering if I created a promise (i.e.
stack.up().then(upRes => // do something with upRes here))
) and then the server crashes (or I do another push and it restarts) mid-process, will the
then
still run?
I assume not right? If that’s the case, then what’s the recommended way to handle this? Should I get the stack outputs (i.e.
await stack.outputs()
) to check the status instead? Does it even return the status?
l
No, the
then
will not run. Generally it is best to avoid canceling inflight updates. It can leave dangling resources and inconsistencies in your state file. You can
cancel
a stack, and remove any pending operations by running
export
and
import
and then refreshing the stack to get the latest state of resources. My recommendation would be to architect your system in such a way that updates can run to completion even when you do a deployment. A queue/worker might make it easier to enable this.
m
So a workflow system like Airflow?
Or a Kubernetes Job?