3

On my production site hosted on vercel, after authentication with clerk, it redirects me to localhost. This only happens on the laptop I'm using for development.

If I connect to the production site on another device, it correctly redirects me back to the production site hosted on vercel after authentication.

I'm following a tutorial for the t3 stack here:https://www.youtube.com/watch?v=YkOSUVzOAA4

I'm new to this stack and using nextJS + vercel + clerk so I'm not sure where to even begin. I'll upload any needed code. Thank you.

Sujio
  • 357
  • 1
  • 2
  • 13
  • I'm getting this same problem, no idea what's causing it. Also are you getting an issue where the posts aren't displaying? I'm having an issue with the api.posts.getAll.useQuery() call where it's just returning data: undefined and isLoading: true and never resolving. It's driving me insane, I followed the tutorial word for word and it's not working – Ben Cavenagh May 23 '23 at 17:55
  • I'm not sure as I'm new to the stack, but I followed the tutorial and it was working for me. I changed the root.ts and added a posts.ts – Sujio May 25 '23 at 07:19
  • Turns out it was my Chrome version. Not sure what was going on but just gave it an update and things started working fine -_- – Ben Cavenagh May 26 '23 at 04:28

1 Answers1

1

Follow Clerk's Next.js setup instructions and it should help get it working. Specifically adding a sign-in and sign-up page and creating these environment variables:

NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/

That should get things working on the Vercel deploy without the weird redirection issue.

https://clerk.com/docs/nextjs/get-started-with-nextjs

Ben Cavenagh
  • 608
  • 1
  • 6
  • 22