-
Notifications
You must be signed in to change notification settings - Fork 419
fix(elements): Display assertIsDefined errors during development
#3517
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
fix(elements): Display assertIsDefined errors during development
#3517
Conversation
🦋 Changeset detectedLatest commit: b446576 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
assertIsDefined errors during development
| if (process.env.NODE_ENV === 'development') { | ||
| assertActorEventError(event); | ||
|
|
||
| throw new ClerkElementsRuntimeError(`Unable to fulfill the prepare or attempt request for the sign-in verification. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can say prepare/attempt here because the action is only used in those two states
| } | ||
|
|
||
| assertIsDefined(params); | ||
| assertIsDefined(params, 'First factor params'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a label to all instances of assertIsDefined. If params would be undefined it would say:
undefined is not defined
With the label it'll say
First factor params is not defined
👍
panteliselef
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Description
So inside our sign-in verification machine we use
assertIsDefineda bunch. Those errors weren't displayed anywhere, you could only see them if you've usedNEXT_PUBLIC_CLERK_ELEMENTS_DEBUG=true.In SDK-1470 I recorded how I got into such a state some time ago. Actually, I wasn't able to reproduce now because our conditional logic is better now. However, if for some reason a user gets into the state of
assertIsDefinedthrowing, they'll now see it at least 👍Fixes SDK-1470
Checklist
npm testruns as expected.npm run buildruns as expected.Type of change