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

Hi @Leonardo-Mazzuca and @raph90 can you open a separate issue with a minimal reproduction if possible? Thanks! #1738

Closed
Leonardo-Mazzuca opened this issue Nov 22, 2024 · 13 comments

Comments

@Leonardo-Mazzuca
Copy link

          Hi @Leonardo-Mazzuca and @raph90 can you open a separate issue with a minimal reproduction if possible? Thanks!

Originally posted by @BRKalow in clerk/javascript#1537 (comment)

@raph90
Copy link

raph90 commented Nov 22, 2024

@Leonardo-Mazzuca did you only experience this today for the first time?

@Leonardo-Mazzuca
Copy link
Author

Actually i found the problem, and for me, it was basically the timestamp of my region. Since i'm on Brazil, it has a 30 seconds delay when i was trying to login, and it was resulting in a future token send error, i guess it called NBC or something like it.

But basically after configure the timestamp of my pc, it solved......but anyway, i will show the test project that i used.

So basically i did everything that is in the clerk Next js docs. I put the ClerkProvider component as usual in the layout.tsx file, and ok. So my Home page ( page.tsx ) got like that:

import { SignedIn, SignedOut, SignInButton, UserButton } from "@clerk/nextjs";
import { auth } from "@clerk/nextjs/server";
import { useId } from "react";

export default async function Home() {

const {userId} = await auth();

console.log('Id: ', userId);

return (

<div className="flex flex-col items-center h-screen justify-center w-full">

  <h1 className="font-bold text-3xl">Test</h1>

  <SignedOut>
    <SignInButton />
  </SignedOut>
  <SignedIn>
    <UserButton />
  </SignedIn>

</div>

);
}

I did just that and i debugged by the console.

But after i cofigured the time stamp of my pc, it solved. And now i can access data from the user using SSC ( server side components ).

I will create a repository with this project test, so you guys can use it, but its just page with a Test text in the middle, but anyway.

I hope this issue is getting fixed.....

So thats the repo: https://github.com/Leonardo-Mazzuca/clerk-server-test/tree/main

I made a small tutorial in the README.md....so i hope i can help

@raph90
Copy link

raph90 commented Nov 22, 2024

Thanks - I'm following this thread:
clerk/javascript#1528
It seems like I might have a bad cookie set somewhere

@Leonardo-Mazzuca
Copy link
Author

@Leonardo-Mazzuca did you only experience this today for the first time?

Yes man....and i was searching for it in the web, but i didn't found anyone with the same exact issue😅

@Leonardo-Mazzuca
Copy link
Author

Thanks - I'm following this thread: clerk/javascript#1528 It seems like I might have a bad cookie set somewhere

I tried it too....by deleting a specific cookie, but it didn't work for me

Can u check your terminal on your application to see if is there any error???

I was receiving this:

Clerk: Clock skew detected. This usually means that your system clock is
inaccurate. Clerk will attempt to account for the clock skew in development.

To resolve this issue, make sure your system's clock is set to the correct time (e.g. turn off and on automatic time synchronization).


JWT cannot be used prior to not before date claim (nbf). Not before date: Fri, 22 Nov 2024 15:01:35 GMT; Current date: Fri, 22 Nov 2024 15:00:46 GMT; (reason=token-not-active-yet, token-carrier=cookie)
Clerk: Clock skew detected. This usually means that your system clock is
inaccurate. Clerk will attempt to account for the clock skew in development.

To resolve this issue, make sure your system's clock is set to the correct time (e.g. turn off and on automatic time synchronization).


JWT cannot be used prior to not before date claim (nbf). Not before date: Fri, 22 Nov 2024 15:01:35 GMT; Current date: Fri, 22 Nov 2024 15:00:46 GMT; (reason=token-not-active-yet, token-carrier=cookie)
Clerk: Clock skew detected. This usually means that your system clock is
inaccurate. Clerk will attempt to account for the clock skew in development.

To resolve this issue, make sure your system's clock is set to the correct time (e.g. turn off and on automatic time synchronization).


JWT cannot be used prior to not before date claim (nbf). Not before date: Fri, 22 Nov 2024 15:01:35 GMT; Current date: Fri, 22 Nov 2024 15:00:47 GMT; (reason=token-not-active-yet, token-carrier=cookie)
Clerk: Refreshing the session token resulted in an infinite redirect loop. This usually means that your Clerk instance keys do not match - make sure to copy the correct publishable and secret keys from the Clerk dashboard.

@raph90
Copy link

raph90 commented Nov 22, 2024

Yeah I do have an error:

Clerk: unable to resolve handshake: [SyntaxError: Unexpected non-whitespace character after JSON at position 4]

But I have no idea what JSON is being referred to

@Leonardo-Mazzuca
Copy link
Author

Yeah I do have an error:

Clerk: unable to resolve handshake: [SyntaxError: Unexpected non-whitespace character after JSON at position 4]

But I have no idea what JSON is being referred to

Wow thats really weird...

Can u show me the repo of your app??? Maybe i can clone it and try to figure out

But i found some things about it and it could be about your project configuration...like the publishable key in your .env file

@raph90
Copy link

raph90 commented Nov 22, 2024

It's a private repo unfortunately - I've double checked my keys and they're 100% correct :(

@Leonardo-Mazzuca
Copy link
Author

raph90

A..... in your browser terminal, is that anything else that we can use to debbug??

Because your problem is different of what i've faced....

Have you tried to create a new project just to test??? And see if is there any error??

@raph90
Copy link

raph90 commented Nov 22, 2024

The issue is on the server not in the browser I think. That's why the clerk error is so obscure. It's calling fetch in the background and there's an error somewhere. Appreciate your help @Leonardo-Mazzuca - I'm going to try messing around with some stuff and see what works

@Leonardo-Mazzuca
Copy link
Author

The issue is on the server not in the browser I think. That's why the clerk error is so obscure. It's calling fetch in the background and there's an error somewhere. Appreciate your help @Leonardo-Mazzuca - I'm going to try messing around with some stuff and see what works

I'm sorry man.....i really would like to help u, because i was fighting with this as well.

I hope someone from clerk see this, because i guess we are not the only ones who was facing problems with SSC....but either way, if u found a solution, comment here!

@raph90
Copy link

raph90 commented Nov 22, 2024

Will do! Good luck! :)

@alexisintech
Copy link
Member

Hi friends, I don't think you meant to open this issue in Clerk Docs. Closing this 👍

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

No branches or pull requests

3 participants