Skip to content
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

Incorrect types for UserProfile (strings are not nullable) #379

Open
NoxHarmonium opened this issue Mar 23, 2023 · 1 comment
Open

Incorrect types for UserProfile (strings are not nullable) #379

NoxHarmonium opened this issue Mar 23, 2023 · 1 comment
Labels

Comments

@NoxHarmonium
Copy link

Describe the bug?

The UserProfile type is defined in:

https://github.com/okta/okta-sdk-nodejs/blob/master/src/types/models/UserProfile.d.ts

It has all the base/built-in profile attributes typed as non-nullable strings.

A quick call to the API via cURL shows that the Okta API can return nulls for these values.

We should probably update these types to reflect what is returned from the Okta API, so that we don't get unexpected type errors.

What is expected to happen?

The UserProfile type matches the actual data coming back from the Okta API.

What is the actual behavior?

The type says that the data cannot be null, but when you access it at runtime, node throws a TypeError and crashes the application.

Reproduction Steps?

  • Fetch a user with nulls in the profile data
  • In our case "mobilePhone" and "secondEmail" were getting returned as nulls for certain users
  • Try to do something on that attribute like trim() that expects the value to be there
  • Watch node crash

SDK Versions

"@okta/okta-sdk-nodejs": "6.6.0"

Execution Environment

node --version
v16.19.0

yarn tsc --version
Version 4.9.5

Additional Information?

No response

@denysoblohin-okta
Copy link
Contributor

Thanks for submitting this issue.
Internal ref: OKTA-593025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants