https://pulumi.com logo
#aws
Title
# aws
s

salmon-ghost-86211

05/27/2020, 2:42 PM
I have been unable to use the
Example Usage
code at
<https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/aws/route53/#getZone>
when the hosted zone name does not exist. I can't even trap it with a try...catch statement (I'm using typescript). Error messages are like
Copy code
error: Running program '/home/bbaker/dev/infrastructure/eks/Pulumi' failed with an unhandled exception:
Error: invocation of aws:route53/getZone:getZone returned an error: invoking aws:route53/getZone:getZone: no matching Route53Zone found
    at /home/bbaker/dev/infrastructure/eks/Pulumi/node_modules/@pulumi/pulumi/runtime/invoke.js:136:33
    at Http2CallStream.<anonymous> (/home/bbaker/dev/infrastructure/eks/Pulumi/node_modules/@grpc/grpc-js/src/client.ts:155:9)
    at Http2CallStream.emit (events.js:322:22)
    at Http2CallStream.EventEmitter.emit (domain.js:482:12)
    at /home/bbaker/dev/infrastructure/eks/Pulumi/node_modules/@grpc/grpc-js/src/call-stream.ts:186:14
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
How do I check if a hosted zone exists?
g

gentle-diamond-70147

05/27/2020, 2:55 PM
It's currently not possible to catch "not found" errors from
.get()
and lookup functions. We have an issue at https://github.com/pulumi/pulumi/issues/3364 to add support for this. As a workaround, you can use the AWS SDK directly (https://github.com/aws/aws-sdk-js) to query for the Zone and then proceed with any Pulumi resources you need based on that.
s

salmon-ghost-86211

05/27/2020, 2:57 PM
Thank you