turbot / steampipe-plugin-aws

Use SQL to instantly query AWS resources across regions and accounts. Open source CLI. No DB required.
https://hub.steampipe.io/plugins/turbot/aws
Apache License 2.0
188 stars 100 forks source link

Failed to populate column 'akas' in aws_health_affected_entity, panic runtime error 😱 #2183

Closed dalenewman closed 4 months ago

dalenewman commented 4 months ago

Describe the bug When I select * from aws.aws_health_affected_entity I get the error:

ERROR:  rpc error: code = Unknown desc = aws: failed to populate column 'akas': rpc error: code = Internal desc = transform EnsureStringArray failed with panic runtime error: invalid memory address or nil pointer dereference 

Steampipe version (steampipe -v) Example: v0.22.2

Plugin version (steampipe plugin list) Example: v0.137.0

To reproduce When I select * from aws.aws_health_affected_entity I get the error:

ERROR:  rpc error: code = Unknown desc = aws: failed to populate column 'akas': rpc error: code = Internal desc = transform EnsureStringArray failed with panic runtime error: invalid memory address or nil pointer dereference 

Expected behavior It should return some results, because I have 21 records from select * from aws.aws_health_event with lots of open and upcoming events.

Additional context I am querying against an AWS gov-cloud account.

ParthaI commented 4 months ago

Hi @dalenewman, I'm sorry to hear about the issues you're encountering. Unfortunately, I was unable to make the DescribeEvents API call in our test environment since our current plan is Basic, and only Business or Enterprise plans can access the AWS Health API.

I've made some updates in the branch issue-2183, including adding a few log statements to the plugin code to help us delve deeper into the issues.

Could you please run the query with the log level set to Debug using the changes in the issue-2183 branch, and then share the plugin logs from the folder ~/.steampipe/logs/plugin-*.log (after removing any sensitive information)?

Here are the steps to run the query with the changes pushed to the branch issue-2183:

Thanks for your help!

dalenewman commented 4 months ago

Attached plugin-2024-05-06.log

ParthaI commented 4 months ago

Hello @dalenewman, thank you for providing the log details.

I've made another commit to the issue-2183 branch that includes updates to the code to address the nil pointer dereference error.

Could you please pull the latest changes from the issue-2183 branch into your local environment and attempt to run the query again after building the plugin locally?

Before you run the query, ensure that all Steampipe processes are terminated. Additionally, if you don't encounter any errors, could you please share the results for the query select * from aws_health_affected_entity where akas is null;? Be sure to remove any sensitive information beforehand. I would like to understand the result set that might be contributing to the issue.

Thank you!

dalenewman commented 4 months ago

Attached Results. Looks like an EC2 operational issue. It has no akas, nor arn. affected-entity-with-akas-null.csv corresponding-event.csv

image

ParthaI commented 4 months ago

Thank you, @dalenewman, for providing the information. From the results, I can see that if we have an operational issue entity, there will not be an ARN for it. I believe the fix appears to be effective. I'll proceed with some code cleanup in the branch and prepare it for review. Thanks again for your assistance!