AWS redshift-data API: An error occurred (ResourceNotFoundException) when calling the DescribeStatement operation: Query does not exist

Question:

I’m currently banging my head against the wall since a few days trying to solve a strange issue happening with the recently released redshift data-api. I’m trying to execute a SQL statement on my Redshift cluster using the execute statement api and list the statement using the list statements api.

When testing locally, the API behaves well and I have no issues listing the statements. However, after deploying my code on Lambda, I’m suddenly not able to find any of my executed queries even though I’m receiving 200 responses for the execute statements requests.

Here is an extract of my CloudWatch logs showing the execute statement 200 response with the query ID:

}

And here is the error I get when trying to describe the SQL statement status using the AWS cli with that query ID.

Answer:

The role/user to execute describe-statement or get-statement-result need to be same with the one you use to execute-statement.

Also, need to be same region.

Leave a Reply