how can I resolve AWS Braket .net sdk invalid request body errors?

0

Currently trying to ingest some data from the aws braket api via the sdk. I'm getting some weird errors relating to the request body in all of my methods

I'm trying to get all of my braket devices through the search endpoint, however this endpoint requires a requestmodel with a list of filters, though according to the docs, the filters list can be empty. I still get an invalid request body. Then the only filter allowed is the device arn, but I don't have those yet because i want to get a list of the devices. There any way to achieve this?

I'm also trying to get a list of all my braket jobs and quantum tasks, but getting an invalid request body for those as well. I am getting the following errors and you can see how im constructing the filters: Message : Invalid search filters supplied. {'name': 'jobArn', 'operator': 'CONTAINS', 'values': [':']} is not valid under any of the given schemas

Message : Invalid search filters supplied. {'name': 'createdAt', 'operator': 'LT', 'values': ['2/4/2025 9:56:36 PM']} is not valid under any of the given schemas

how can i just get a list of these resources?

1 Answer
0

It seems you're encountering issues with the AWS Braket .NET SDK, particularly with search requests for devices, jobs, and quantum tasks. Let's address these issues one by one:

For getting a list of Braket devices: The search endpoint for devices does indeed require a request model with filters, but you're correct that the filters list can be empty. If you're still getting an invalid request body error with an empty filter list, there might be an issue with how you're constructing the request. Make sure you're creating a valid SearchDevicesRequest object, even if it has an empty filters list.

For getting a list of Braket jobs and quantum tasks: The errors you're seeing suggest that the filter construction is incorrect. Here are some tips to resolve these:

  1. For the jobArn filter: The 'CONTAINS' operator might not be appropriate for ARNs. Try using 'EQUAL' instead, or if you want to match partial ARNs, ensure the value is a valid partial ARN string.

  2. For the createdAt filter: The date format you're using might not be what the API expects. AWS typically uses ISO 8601 format for dates. Try formatting your date as "2025-02-04T21:56:36Z" instead.

To get a list of resources without specific filters:

  1. For devices: Try creating a SearchDevicesRequest with an empty filters list.
  2. For jobs and tasks: If possible, try creating SearchJobsRequest and SearchQuantumTasksRequest objects without any filters, or with very broad filters (like a date range that covers all possible creation dates).

If you continue to face issues, double-check the SDK documentation for the exact format of the request objects and filters. Also, ensure you're using the latest version of the AWS Braket .NET SDK, as older versions might have bugs that have been fixed in newer releases.

If problems persist, you might want to try using the AWS CLI or AWS SDK for another language (like Python) to see if you can successfully make these requests. This can help determine if the issue is specific to the .NET SDK or if it's a more general problem with your AWS account or permissions.
Sources
How to set request body with AWS CRT HTTP Client? | AWS re:Post
Get request body from custom lambda authorizer | AWS re:Post
JSON Array in RequestBody not supported? | AWS re:Post

profile picture
answered 13 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions