New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Valid x-typesense-api-key
header must be sent
#115
Comments
Update:Searching, retrievals, etc... using dart's HTTP library generates no issues. Admin Key & Scoped Search Keys are working without any inconveniences atm. |
Hey @elhe26
Also, have you used the dart SDK to generate the search key? |
Regarding Error 2, |
I created the key from the server using typesense-js. When using the scoped key from the shell, I don't get any issues. When using it from the client I get that error. |
I'm assuming you're referring to creating a scoped search key here? |
Yes. I used the admin key to create a search-only key and then I generated the scoped key. |
@elhe26 I tried to reproduce the issue with the following code and found nothing. void main(List<String> arguments) async {
/// Initial search key generated by the typesense cluster.
final searchKey = 'SSw1XmjxjjcA2Raq0UhNPgPff7XTLbF7';
final config = Configuration(
searchKey,
nodes: {
Node(
Protocol.https,
'Host',
),
},
);
final client = Client(config);
// Generate scoped search key
final scopedSearchKey = client.keys.generateScopedSearchKey(
'SSw1XmjxjjcA2Raq0UhNPgPff7XTLbF7',
{
'query_by': 'company_name',
'filter_by': 'country:=abc && num_employees:>0',
},
);
print(scopedSearchKey);
final configuration = Configuration(
scopedSearchKey,
nodes: {
Node(
Protocol.https,
'Host',
),
},
);
final clientWithScopedSearchKey = Client(configuration);
print(
await clientWithScopedSearchKey.collection('companies').documents.search(
{
'q': '',
},
),
);
} I believe you're trying to perform an action that's out of the scope of the key. Using the admin key try retrieve and look for the permissions of the key you're using. |
Thanks @happy-san. I'm following the docs but I'm getting the same issue. I'll start over again and see if that works. |
For future reference, try to log your exact steps. |
Describe the bug
It seems the Configuration object is not setting the API key. Basic configuration:
Related: Typesense Error 476
Steps to reproduce the behavior:
Expected behavior
1 . Return either collections or documents.
Additional context
Error 1
Error 2
This error is also a weird behavior from the client SDK. All schema variables are defined with type and facet. If the client is not throwing Error 1, it's giving this other error:
"value" variable config (Schema):
Note:
Setting the "sendApiKeyAsQueryParam" variable won't change the outcome.
The text was updated successfully, but these errors were encountered: