Hi. I'm getting this error: "400: {"message": "Fi...
# community-help
e
Hi. I'm getting this error: "400: {"message": "Field
value
should be a string or a string array."}". value specs:
{
"facet": false,
"index": true,
"name": "value",
"optional": false,
"type": "float"
},
I'm using version 0.22.1
Also, I keep getting this error too: `401: {"message": "Forbidden - a valid
x-typesense-api-key
header must be sent."}`
@Kishore Nallan
What is interesting is that performing the search with shell works but Dart doesn't
I don't even get "400 Field should be string..." error.
k
Can you please create an exact code snippet that reproduces the error consistently?
e
I'm using all 3 keys (Admin Key, Search-only Key and Tenant Key (created using filter_by and Search-only ket))
k
Without the exact reproduceable code snippet, difficult to identify what's going wrong...
e
Copy code
await client!.collection(collection).documents.search({
  "q": value ?? "*",
  "query_by": queryBy,
});
k
I mean a fully reproduceable example with the client initialization as well. I recommend starting fresh on a new file so that if there was any mistake you can quickly identify it.
e
oh
Typesense Service
Copy code
class SearchService {
Client? client;
String searchOne = "add-endpoint-here";
String searchTwo = "add-endpoint-here";
String searchThree = "add-endpoint-here";

void initialize(String searchKey) {
    var config = Configuration(
      searchKey,
      nodes: {
        Node(Protocol.https, searchOne, port: 443),
        Node(Protocol.https, searchTwo, port: 443),
        Node(Protocol.https, searchThree, port: 443),
      },
      connectionTimeout: Duration(seconds: 2),
    );
    client = Client(config);
}

  Future<dynamic> Search(
    String? value,
    String queryBy,
    String collection,
  ) async {
    try {
      var search = await client!.collection(collection).documents.search({
        "q": value ?? "*",
        "query_by": queryBy,
      });
         return search;
        } catch(err){
          return err;
        }
}
k
That looks fine to me. And the problem occurs only with the scoped API key?
e
scoped API key = error Search-only key = error Admin key = error
Either "400 Field..." or "404 Forbidden..."
Using shell everything works.
k
Hmm 🤔 Have you tried running the official client example? https://github.com/typesense/typesense-dart/tree/master/example/console-simple
e
I was following the example code on pub.dev
Our backend config is working without any issues. Any query from shell is working.
There's something when logging Configuration object.
I'm getting "Send api key in query: false"
k
Can you summarize the problem you are facing and post on the dart client repository here? https://github.com/typesense/typesense-dart/issues
e
No problem.
k
I will request one of the dart client maintainers to take a look. Since I'm unable to spot anything grossly wrong, maybe another pair of eyes will help.
e
👍🏾
Done.
k
ty