unkey
unkey copied to clipboard
Gracefull Error Handling for the following payload
Preliminary Checks
-
[X] I have reviewed the documentation: https://unkey.dev/docs
-
[X] I have searched for existing issues: https://github.com/unkeyed/unkey/issues
-
[X] This issue is not a question, general help request, or anything other than a bug report directly related to Unkey. Please ask questions in our Discord community: https://unkey.dev/discord.
Reproduction / Replay Link (Optional)
No response
Description
curl --location 'https://api.unkey.dev/v1/keys'
--header 'Authorization: Bearer <TOKEN>'
--header 'Content-Type: application/json'
--data '{
"apiId": "<API_ID>",
"byteLength":0
}'
Debugged this for quite sometime as why was I getting the 500 error while building Springboot (JAVA) SDK for unkey, as my code in backend was setting byteLength as 0 instead of null. Hence, the error. Just reporting it if it can be handled gracefully. Error : runtime error: slice bounds out of range [:5] with length 2 It could be something like byteLength can't be 0 (or less 2). It's working for byteLength:2 and above.
Environment
No response
I would like to work on this issue @perkinsjr
@shreyanshtomar cool stuff working on the sdk. Can you link it here or maybe tag me on disc? Im shawshankkumar everywhere :)
Will be fixed here, thanks for creating the issue to track it! https://github.com/unkeyed/unkey/blob/178797b7ae91327130d7299a21695c863d9abaee/apps/api/src/routes/v1_keys_createKey.ts#L49