Boto3 CreateTemplate() filter error

Hi,

I’m trying to use CreateTemplate() in boto3 to create a template using a definition instead of a source analysis. When passing the ‘Sheets’ option I get this error.

An error occurred (InvalidParameterValueException) when calling the CreateTemplate operation: Expected Filter: dbf81f81-83ca-47a7-924e-2deb69247715 referenced should exist in Filters List,
at Filter Control 061a61c9-5da0-4f10-9c4f-d896b7d0f5c1,
at Sheet dac499bc-c849-4b06-85a9-dc3b46f19a05.

The sheets are being pulled from another analysis using DescribeAnalysisDefinition(). I can’t see any reference to a filter list.

Any ideas why the sheets definition I’m pulling doesn’t include this? The filter works well in the analysis I am describing.

Thanks!

1 Like

Hello @jonnyp, basicallly, this is an error that is coming from the definition that is causing the template creation to fail, so we will need to fix that. You have 2 options to handle this, and neither are fun so you can pick your poison.

  1. Dump the definition manually, find the filter that is causing the error, then track down the filter on the front end and delete it
  2. Build a process that will delete the filter from the definition programatically

The error process for the APIs can be a bit messy, and even a perfectly functioning Quick Sight resource can cause errors in the definition. Once you are able to resolve the filter within the definition, you should be able to create your template. I hope this helps!

1 Like

Hi @WLS-DM thanks for your response! I have found the filter, the only issue is that this is a critical datetime filter which users need in the dashboard so it isn’t really an option to delete it.

I did try deleting it and which fixed it but another filter then had an error (unrelated to the first, but this would also then need deleting). Ultimately I want my dashboard working as is and am confused why a filter that looks fine in the UI is throwing this error.

Thanks!

1 Like

Hello @jonnyp, yeah, I completely understand. The boto3 APIs are great, but they still have some issues that can be difficult to work around. Basically, the easiest way to manage this is to fix the error by deleting the filter on the definition, then re-add it to the new version once it is moved over.

Even though it is working fine in the source version, it will be more difficult, if not impossible, to resolve the error on the source side. Adding the filter back at the end will the best way to accomplish this, while still allowing the resource to be migrated

We hope this solution worked for you. Let us know if this is resolved. And if it is, please help the community by marking this answer as a “Solution.” (click the check box under the reply)