https://pulumi.com logo
Title
a

adamant-translator-31969

04/19/2021, 9:35 PM
Hi everyone! I have a problem with getRouteTable method ... I have this error
Your query returned no results. Please change your search criteria and try again
b

billowy-army-68599

04/19/2021, 9:36 PM
hopefully the error explains itself. your query didn't return any results - can you share your code?
a

adamant-translator-31969

04/19/2021, 9:40 PM
@billowy-army-68599
let routeTableResult = [];
routeTableResult.push(
            aws.ec2.getRouteTable({
              subnetId: Elements,
              vpcId: id,
            })
          );
but with this query , I have not empty result and empty ... I want to avoid empty result
And I want to save values that not are empty
r

red-match-15116

04/19/2021, 9:45 PM
Then you should handle the error if it’s empty
a

adamant-translator-31969

04/19/2021, 9:46 PM
okay! and how can i do this?
b

billowy-army-68599

04/19/2021, 9:49 PM
i'm not quite following what you're trying to do, really sorry. Can you elaborate a bit more?
a

adamant-translator-31969

04/19/2021, 10:02 PM
@billowy-army-68599 I want to get the route tables with subnet id and vpc id filters. I want to save this result in an array to later work on it. I know that the query gives empty results and non-empty results, but I only want to save the non-empty results.
r

red-match-15116

04/19/2021, 10:41 PM
So… this array will have 1 item or be empty?
In any case, I’m not sure you would get the result you want here. The result of
getRouteTable
is an
Output
, which gets resolved asynchronously… so when you try to “save it for later”, things might not execute in the order you expect.
👍 1
If you share more of your code and an explanation of what you’re trying to do we might be able to help point you in the right direction.