Hi. I just tried upgrading from 0.25.2 to 27.1 and...
# community-help
d
Hi. I just tried upgrading from 0.25.2 to 27.1 and am getting an error message from a search API request for which I am not sure what fix to pursue. Thoughts?
Error while applying embedded parameters
I only have one environment so I had to rollback that environment. I spun up a new cluster for testing and made it 27.1. I cannot recreate that issue on the new testing cluster
j
In versions since 0.25 we've added more validations to parameters embedded inside scoped API keys, so they don't silently fail.
So I would recommend trying to generate various scoped api keys and testing with those on the new cluster
d
Thanks for the response. Is there a way to get more details on what might be failing with the scoped API keys?
@Jason Bosco I am trying to create a scoped key in the mac shell to test with. I am using
KEY_WITH_SEARCH_PERMISSIONS="MYAPIKEY
EMBEDDED_SEARCH_PARAMETERS_JSON='{"filter_by":"Industries:Accounting"}'
digest=$(echo -n $EMBEDDED_SEARCH_PARAMETERS_JSON | openssl dgst -sha256 -hmac $KEY_WITH_SEARCH_PERMISSIONS -binary | base64)
scoped_api_key=$(echo -n "${digest}${KEY_WITH_SEARCH_PERMISSIONS:0:4}${EMBEDDED_SEARCH_PARAMETERS_JSON}" | base64)
echo $scoped_api_key
However, when I try to use the resulting scoped_api_key, I get the following error:
{
"message": "Forbidden - a valid x-typesense-api-key header must be sent."
}
j
There's a missing double quote at the end of this line:
Copy code
KEY_WITH_SEARCH_PERMISSIONS="MYAPIKEY
d
Yah. That was just an artifact of my deleting my api key to paste into slack. I get what looks to be a legitimate key, but typesense responds that it’s not.
The same process for making keys works on v0.25.2 but not on 27.1
j
I see this error in the logs in in your v27.1 cluster:
Copy code
Parent API key must allow only `documents:search` action. Key prefix: 9ihv
Could you make sure the permissions for the parent API key are identical and also scoped down to just
documents:search
?
d
I thought that might be the issue, so I made another key that I have been using
message has been deleted
j
I wonder if there's a mac specific issue may be with openssl or base64 versions?
But you're saying the same set of commands work with v0.25?
Could you give me the full curl command with the scoped api key in place that throws the forbidden error?
d
Copy code
curl --location '<https://01isob9acj3mh7x5p-1.a1.typesense.net/collections/employers_live_no/documents/search?query_by=Description%2CEngagement%20Priority%2CExternal%20CSM%20Link%2CFacebook%2CGeneral%20Email%2CIndustries%2CLead%20Status%2CLinkedIn%2CLocation%2CName%2CPhone%20Number%2CWebsite&q=*&infix=always%2Calways%2Calways%2Calways%2Calways%2Calways%2Calways%2Calways%2Calways%2Calways%2Calways%2Calways>' \
--header 'X-TYPESENSE-API-KEY: N0NBWFJ6VEhQeGw4Z3M4TFpsOGJVMG85RnRYOHptL3FaWkZKSi82WTJXbz17ImZpbHRlcl9ieeKAnTrigJ1JbmR1c3RyaWVzOkFjY291bnRpbmfigJ19'
That one doesn't work
j
Could you surround that with 3 backticks? Otherwise slack messes up quotes when copying
d
This one does
Copy code
curl --location '<https://01isob9acj3mh7x5p-1.a1.typesense.net/collections/employers_live_no/documents/search?query_by=Description%2CEngagement%20Priority%2CExternal%20CSM%20Link%2CFacebook%2CGeneral%20Email%2CIndustries%2CLead%20Status%2CLinkedIn%2CLocation%2CName%2CPhone%20Number%2CWebsite&q=*&infix=always%2Calways%2Calways%2Calways%2Calways%2Calways%2Calways%2Calways%2Calways%2Calways%2Calways%2Calways>' \
--header 'X-TYPESENSE-API-KEY: Il2pYjIy65Leayhlj2BPZdup5UdSzo9v'
j
In the actual scoped API key, I see the "wrong" double quotes:
Copy code
{"filter_by”:”Industries:Accounting”}
Notice how the double quotes are different between the one that's before filter_by and the ones after that
You want to use the first type of double quotes throughout
Straight Double Quote (") Unicode: U+0022
And NOT this one:
Curly (Right) Double Quotation Mark (”): Unicode: U+201D
d
you are correct!
🙌 1
j
(I'd recommend revoking the parent API keys you just shared)
d
will do. thanks
👍 1
Thanks for all your help!
j
Happy to help