https://pulumi.com logo
Title
f

fresh-hospital-81544

05/03/2021, 8:52 AM
Hi, in my code Pulumi is missing some dependencies which makes the script fail I have this in one part of my code
const retry_queue = new aws.sqs.Queue("retry", {
        delaySeconds: 180,
        messageRetentionSeconds: 345600, // 4 days
and then later
});
const queueURL = retry_queue.name.apply(name => aws.sqs.getQueue({
        name: name,
    }).then(queue => queue.url));
however when I up this I get the error that the queue with the name is not available.
error: Running program '/working/src/stack-staging' failed with an unhandled exception:
    Error: invocation of aws:sqs/getQueue:getQueue returned an error: invoking aws:sqs/getQueue:getQueue: 1 error occurred:
        * Error getting queue URL: AWS.SimpleQueueService.NonExistentQueue: The specified queue does not exist for this wsdl version.
If I hard code the queueURL and
pulumi up
and then restore the second snippet then the script works. Is there a way to ensure a dependency here?
c

cool-egg-852

05/03/2021, 2:51 PM
As far as I can see there is no
url
property on
Queue
. Where are you getting
.url
from?
f

fresh-hospital-81544

05/03/2021, 9:53 PM
the
url
property is on
aws.sqs.getQueue
c

cool-egg-852

05/04/2021, 6:42 PM
Ah. I was looking at
get()
not
getQueue()
.
I would look at the stack and see the value of
name
on the
retry
Queue
resource. Are you able to hardcode the value of
name
in
getQueue
with whatever that value is?
f

fresh-hospital-81544

05/06/2021, 12:33 AM
this isnt getting used downstream, only as an output so i am able to put a dummy value. when I do that and
pulumi up
then it runs, then replace the dummy value with the original code and
pulumi up
again then everything works. The issue as I see it is that it is trying to get the name of the queue in the preview, (before I confirm the stack update) and on first run this obviously isnt going to exist.