-
Notifications
You must be signed in to change notification settings - Fork 222
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
"Secure API keys" are buggy #1388
Comments
Hey catam, are you using the admin key? |
We attempted using a "Search Only Key" but it didn't work. |
@HubertRyanOfficial I have tested generating "secure API key" using a "Search Only Key" and the bugs are the same. |
TypeError: Cannot convert undefined or null to object
We've found the cause for the Issues |
@catamphetamine Yeah, I got it. |
generateSecuredApiKey(key, {})
called with empty options argument.When that function is called with
{}
as the options argument, it returns some API key.When later querying anything using that generated API key on the front end, it returns error:
TypeError: Cannot convert undefined or null to object
when no options passed.When
generateSecuredApiKey(key, {})
function is called without the second ("options") argument, it throws:https://discourse.algolia.com/t/ivalid-api-key-when-passed-a-perfectly-valid-key/14419
restrictIndices
, such key returns an error when used for querying on front end:When a "secured API key" is generated using the same code but with
restrictIndices
being"*"
, it doesn't throw any errors.We've narrowed that issue down to Algolia failing when there're more than a few index names enumerated in
restrictIndices
.For example, in our case, we use index name prefixes with wildcards in
restrictIndices
.If we add 4 index name prefixes, it stops working.
But when we add, for example, just 2 index name prefixes, and a wildcard (
"*"
), it works.The text was updated successfully, but these errors were encountered: