This message was deleted.
# general
s
This message was deleted.
b
The
aws.sqs.getQueue
function returns a
Promise<GetQueueResult>
(https://github.com/pulumi/pulumi-aws/blob/cfcf3ed0c7019484ffc2a62de4498e41d802ee71/sdk/nodejs/sqs/getQueue.ts#L12). In JavaScript, you would need to somehow rendezvous with the promise's result, as it is produced asynchronously, either using the new
await
syntax if you're on a newer Node.js or TypeScript (https://www.typescriptlang.org/docs/handbook/release-notes/typescript-1-7.html), or use the
then
function to retrieve it (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then). For instance
Copy code
exports.QueueArn = theQueue.then(q => q.arn);
Note here that
QueueArn
will itself be a promise. An alternative way to accomplish this same thing is to use the static function
aws.sqs.Queue.get
, in which case the code you wrote will work almost exactly as-is:
Copy code
const theQueue = aws.sqs.Queue.get("the-queue");
exports.QueueArn = theQueue.arn;
It's unfortunate there are two ways to do this same thing, however in many cases the functions offer slightly different functionality -- in this case, they are virtually identical.
e
Thanks. Spotted my problem. When using
then
I was trying to return the object! Cheers
👍 1