Hi everyone! I have a problem with getRouteTable m...
# aws
a
Hi everyone! I have a problem with getRouteTable method ... I have this error
Copy code
Your query returned no results. Please change your search criteria and try again
b
hopefully the error explains itself. your query didn't return any results - can you share your code?
a
@billowy-army-68599
Copy code
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
Then you should handle the error if it’s empty
a
okay! and how can i do this?
b
i'm not quite following what you're trying to do, really sorry. Can you elaborate a bit more?
a
@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
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.