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

useClerk() does not return a proper Clerk instance type #1953

Closed
4 tasks done
kalebpace opened this issue Oct 29, 2023 · 3 comments
Closed
4 tasks done

useClerk() does not return a proper Clerk instance type #1953

kalebpace opened this issue Oct 29, 2023 · 3 comments
Assignees
Labels
bug Something isn't working prioritized This issue has been triaged and the team is working on it react

Comments

@kalebpace
Copy link

kalebpace commented Oct 29, 2023

Preliminary Checks

Reproduction / Replay Link

https://codesandbox.io/p/sandbox/awesome-easley-m9m88h?file=%2Fapp%2Fpage.tsx

Publishable key

pk_test_Z2VudGxlLWxhYi04NC5jbGVyay5hY2NvdW50cy5kZXYk

Description

Steps to reproduce:

  1. Import useClerk from @clerk/nextjs or @clerk/clerk-react
  2. Use the hook to get access to a clerk object
  3. Attempt to use clerk as normal (e.g. clerk.instanceType)

Expected behavior:

clerk.instanceType should return either "development" or "production"

Actual behavior:

clerk.instanceType always returns "undefined" with no runtime or type errors. The developer must instead access the normal Clerk object under clerk.clerkjs.instanceType and use //@ts-ignore to satisfy type checking, along with disabling any eslint rule violations.

Environment

In the above codesandbox, the NextJS version is 14 which exhibits the same behavior as the local environment which is on NextJS 13.4.3. Output below is from local machine with relevant deps listed.

System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M1 Pro
    Memory: 359.39 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.1 - /nix/store/y4n2ky0jqqhhknr70vkn6fz11bajzl6k-nodejs-18.17.1/bin/node
    npm: 9.6.7 - /nix/store/y4n2ky0jqqhhknr70vkn6fz11bajzl6k-nodejs-18.17.1/bin/npm
    pnpm: 8.5.1 - /run/current-system/sw/bin/pnpm
  Browsers:
    Chrome: 118.0.5993.117
    Safari: 17.0
  npmPackages:
    @clerk/clerk-js: ^4.64.1 => 4.64.1 
    @clerk/clerk-react: ^4.27.1 => 4.27.1 
    @clerk/nextjs: ^4.26.1 => 4.26.1 
    @clerk/types: ^3.57.0 => 3.57.0 
    next: 13.4.3 => 13.4.3 
    react: 18.2.0 => 18.2.0 
    swr: ^2.2.2 => 2.2.2 
    typescript: 5.0.4 => 5.0.4
@kalebpace kalebpace added the needs-triage A ticket that needs to be triaged by a team member label Oct 29, 2023
@jescalan jescalan added the linear Created by Linear-GitHub Sync label Oct 30, 2023
@jescalan jescalan 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 linear Created by Linear-GitHub Sync labels Nov 27, 2023
@LekoArts LekoArts added bug Something isn't working react labels Nov 29, 2023
@LekoArts LekoArts self-assigned this Nov 29, 2023
@LekoArts
Copy link
Member

Hi, thanks for the issue!

I was able to reproduce it and I also know what will fix it. The PR #2226 will align clerk.clerkjs and what you can access from useClerk.

Once the PR is merged we'll backport it to the current v4 branch (since we're working on v5 at the moment) and then release it as a hotfix for the current latest version.

@kalebpace
Copy link
Author

Amazing, thanks so much for the attention to this!

@LekoArts
Copy link
Member

LekoArts commented Dec 4, 2023

Hello!

This was released in #2235 - once you update to the versions mentioned there it should work.

I'll close this but please let me know if it still doesn't work!

@LekoArts LekoArts closed this as completed Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working prioritized This issue has been triaged and the team is working on it react
Projects
None yet
Development

No branches or pull requests

3 participants