-
Notifications
You must be signed in to change notification settings - Fork 253
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
Node SDK: verifyToken
function has wrong signature
#2280
Labels
prioritized
This issue has been triaged and the team is working on it
Comments
mboudreau
added
the
needs-triage
A ticket that needs to be triaged by a team member
label
Dec 7, 2023
24 tasks
dimkl
added
prioritized
This issue has been triaged and the team is working on it
and removed
needs-triage
A ticket that needs to be triaged by a team member
labels
Dec 7, 2023
Hello @mboudreau |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Preliminary Checks
I have reviewed the documentation: https://clerk.com/docs
I have searched for existing issues: https://github.com/clerk/javascript/issues
I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)
This issue is not a question, general help request, or anything other than a bug report directly related to Clerk. Please ask questions in our Discord community: https://clerk.com/discord.
Reproduction / Replay Link
https://github.com/clerk/javascript/blob/main/packages/sdk-node/src/clerkClient.ts#L11
Publishable key
yeah, nah
Description
Steps to reproduce:
@clerk/clerk-sdk-node@4.12.23
clerkClient.verifyToken(token)
issuer
to be specified even though it shouldn't be required.Expected behavior:
The signature should be able to accept a single argument as per your code, but because the (
ExtendedClerk
type references@clerk/backend
for theverifyToken
type)[https://github.com/clerk/javascript/blob/main/packages/sdk-node/src/clerkClient.ts#L11] and since that signature is a broken, it breaks the child.I personally find it weird that the backend code requires the second argument with empty object fallback as all the properties inside this options object should be optional except for some reason, the
issuer
hasn't been made optional in the option signature, even though it is optional in the code forverifyToken
.Furthermore, code like this type signature makes it extremely hard to read and gives very little value to your developers other than not having to copy some types over, but the issue now lies that the base type has immense power over your SDK signature which can break things as clearly shown here. Having 2 picks and your own extension to the type shows that your types are not well thought out and should be reassessed for better abstraction, or maybe it might be easier to just have an explicit type for each function to prevent these kinds spaghetti type issues in the future.
Actual behavior:
verifyToken
signature won't allow singletoken
argument without breaking.Environment
Doesn't matter
The text was updated successfully, but these errors were encountered: