javascript icon indicating copy to clipboard operation
javascript copied to clipboard

`SignInButton` `SignUpButton` `redirectUrl` doesn't respect `basePath`

Open xixixao opened this issue 1 year ago • 1 comments

Preliminary Checks

  • [X] I have reviewed the documentation: https://clerk.com/docs
  • [X] I have searched for existing issues: https://github.com/clerk/javascript/issues
  • [X] I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)
  • [X] 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/xixixao/bug-clerk-next-redirectUrl

Publishable key

pk_test_cHJvcGVyLXdoaXBwZXQtNzcuY2xlcmsuYWNjb3VudHMuZGV2JA

Description

  1. Run npm run dev
  2. On the page, click on sign in or sign up
  3. Go through

This only works because I added the basePath configured in next.config.mjs to app/page.tsx to the redirectUrl props. But the this should not be needed, and the basePath should be taken into account automatically.

Environment

System:
    OS: macOS 14.2.1
    CPU: Apple M1
  Binaries:
    Node: 18.17.0 - ~/Library/Caches/fnm_multishells/2125_1705529595263/bin/node
    npm: 9.6.7 - ~/Library/Caches/fnm_multishells/2125_1705529595263/bin/npm
    pnpm: 8.7.4 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 120.0.6099.234
    Safari: 17.2.1
  npmPackages:
    @clerk/nextjs: ^4.29.4 => 4.29.4
    @types/node: ^20 => 20.11.5
    @types/react: ^18 => 18.2.48
    @types/react-dom: ^18 => 18.2.18
    autoprefixer: ^10.0.1 => 10.4.17
    eslint: ^8 => 8.56.0
    eslint-config-next: 14.1.0 => 14.1.0
    next: 14.1.0 => 14.1.0
    postcss: ^8 => 8.4.33
    react: ^18 => 18.2.0
    react-dom: ^18 => 18.2.0
    tailwindcss: ^3.3.0 => 3.4.1
    typescript: ^5 => 5.3.3

xixixao avatar Jan 20 '24 05:01 xixixao

Hi, thanks for the issue!

To the best of our knowledge Next.js doesn't expose the basePath option to packages like Clerk so we can't support it. We'll give this some 30min or so to see if we could access it. Still, if we could do, it would be a breaking change.

For the time being I do recommend settings your base path in an environment variable or constant and use those across the config and paths.

LekoArts avatar Jan 29 '24 15:01 LekoArts

Resolved in https://github.com/clerk/javascript/pull/4063

alexcarpenter avatar Sep 19 '24 17:09 alexcarpenter

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

clerk-cookie avatar Sep 20 '25 00:09 clerk-cookie