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

Clerk: Clock skew detected #86

Open
PrtHub opened this issue Sep 28, 2023 · 40 comments
Open

Clerk: Clock skew detected #86

PrtHub opened this issue Sep 28, 2023 · 40 comments

Comments

@PrtHub
Copy link

PrtHub commented Sep 28, 2023

Error: Clerk: Clock skew detected. This usually means that your system clock is inaccurate. Clerk will continuously try to issue new tokens, as the existing ones will be treated as "expired" due to clock skew.

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: Thu, 28 Sep 2023 06:35:34 GMT; Current date: Thu, 28 Sep 2023 06:35:04 GMT; (reason=token-not-active-yet, token-carrier=cookie)

@MatthewAraujo
Copy link

I get this error all the time, I usually speed up the timer and stop this error but I think it is something clerk is trying to fix

@maxidv88
Copy link

I have the same problem when I try to login with Clerk authentication.

@maxidv88
Copy link

In my case I'm running WSL2 with Ubuntu in my Windows 11 machine. When I checked the time in the ubuntu terminal (where the nextjs app is running) it was out of sync with Windows so I had to update it manually with the following command sudo hwclock -s. After that the problem was solved. I read that it's a common problem when the computer go to sleep, the Ubuntu clock gets out of sync with Windows.

@rukemn
Copy link

rukemn commented Oct 2, 2023

Encountered the same Problem on WSL2, computer was also put to sleep before . sudo hwclock -s did not fix it for me, only restarting the server a second time does it for me.

@TomaszKulaDev
Copy link

`
1 of 1 unhandled error
Server Error
Error: Clerk: Clock skew detected. This usually means that your system clock is inaccurate. Clerk will continuously try to issue new tokens, as the existing ones will be treated as "expired" due to clock skew.

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: Sat, 07 Oct 2023 17:50:14 GMT; Current date: Sat, 07 Oct 2023 17:50:07 GMT; (reason=token-not-active-yet, token-carrier=cookie)

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
assertClockSkew
node_modules@clerk\nextjs\dist\esm\server\authMiddleware.js (173:10)
assertClockSkew
node_modules@clerk\nextjs\dist\esm\server\authMiddleware.js (73:6)
async adapter
node_modules\next\dist\esm\server\web\adapter.js (150:19)
async runWithTaggedErrors
file:///C:/Users/xxx/Desktop/nextjs13/node_modules/next/dist/server/web/sandbox/sandbox.js (96:24)
async DevServer.runMiddleware
file:///C:/Users/xxx/Desktop/nextjs13/node_modules/next/dist/server/next-server.js (962:24)
async DevServer.runMiddleware
file:///C:/Users/xxx/Desktop/nextjs13/node_modules/next/dist/server/dev/next-dev-server.js (250:28)
async DevServer.handleCatchallMiddlewareRequest
file:///C:/Users/xxx/Desktop/nextjs13/node_modules/next/dist/server/next-server.js (1051:22)
async DevServer.handleRequestImpl
file:///C:/Users/xxx/Desktop/nextjs13/node_modules/next/dist/server/base-server.js (736:32)`

@FredDaFed
Copy link

If you are using WSL with windows, it will be slightly off.

ISSUE:
image

SOLUTION:
If you go into your Ubuntu WSL terminal, the command below will fix the issue:

sudo apt install ntpupdate && sudo ntpdate pool.ntp.org

RESULTS:
9 Oct 06:46:10 ntpdate[31661]: step time server 129.250.35.250 offset +148.127650 sec
Restart your server then it should work as seen below:
image
After Signing in and accessing secured page:
image

Checking home page after signing in:
image

@Diwanshumidha
Copy link

I dont have wsl setup in my computer still getting this problem

@Rhishikesh12
Copy link

If you are using Windows 11 and encountering an error, you can attempt to resolve it by following these steps:

  • Click on "Settings" in the Windows Start menu.
  • Navigate to "Time & Language" within the Settings menu.
  • Select "Date & Time" from the Time & Language options.
  • Click on "Additional Settings."
  • Finally, select "Sync now" to synchronize your system's date and time settings.

image

This fixed my issue, You can give it a try.

@ariandanim
Copy link

I am using Windows 11 the latest 22H2, I am only set to ON in this setting date & time
image

@Roeck
Copy link

Roeck commented Oct 18, 2023

If you are using Windows 11 and encountering an error, you can attempt to resolve it by following these steps:

* Click on **"Settings"** in the Windows Start menu.

* Navigate to **"Time & Language"** within the Settings menu.

* Select **"Date & Time"** from the Time & Language options.

* Click on **"Additional Settings."**

* Finally, select **"Sync now"** to synchronize your system's date and time settings.

image

This fixed my issue, You can give it a try.

I've just tried that, including restarting the system. This error just started happening suddenly, the app was opening normally and I didn't change any date and time settings. I also checked my project on Clerk and everything seems fine on there. What else could it be?

@Roeck
Copy link

Roeck commented Oct 18, 2023

If you are using Windows 11 and encountering an error, you can attempt to resolve it by following these steps:

* Click on **"Settings"** in the Windows Start menu.

* Navigate to **"Time & Language"** within the Settings menu.

* Select **"Date & Time"** from the Time & Language options.

* Click on **"Additional Settings."**

* Finally, select **"Sync now"** to synchronize your system's date and time settings.

image

This fixed my issue, You can give it a try.

I've tried that but unfortunately it's still happening. I didn't mess with my date and time settings, the project was opening normally and that issue just suddenly started happening! This is so odd. What else could that be?

@Roeck
Copy link

Roeck commented Oct 18, 2023

I've tried fixing the time on settings but unfortunately it's still happening. I didn't mess with my date and time settings, the project was opening normally and that issue just suddenly started happening! This is so odd. What else could that be?

@annandltp
Copy link

If you are using Windows 11 and encountering an error, you can attempt to resolve it by following these steps:

  • Click on "Settings" in the Windows Start menu.
  • Navigate to "Time & Language" within the Settings menu.
  • Select "Date & Time" from the Time & Language options.
  • Click on "Additional Settings."
  • Finally, select "Sync now" to synchronize your system's date and time settings.

image

This fixed my issue, You can give it a try.

this work, thanks

@TomaszKulaDev
Copy link

Well i fix it but i dont rly know how.

  1. Update windows install all updates.
  2. https://www.worldtimeserver.com/atomic-clock/
  • ping google.com
  • ping 8.8.8.8
  • ping time.windows.com
  1. https://www.youtube.com/watch?v=7KFJDFkiaAg

One ot this steps fix my issue in sync time.

@Rohianon
Copy link

In my case I'm running WSL2 with Ubuntu in my Windows 11 machine. When I checked the time in the ubuntu terminal (where the nextjs app is running) it was out of sync with Windows so I had to update it manually with the following command sudo hwclock -s. After that the problem was solved. I read that it's a common problem when the computer go to sleep, the Ubuntu clock gets out of sync with Windows.

Resolved my isssue clearly.
Thanks

@bhaski2003
Copy link

If you are using Windows 11 and encountering an error, you can attempt to resolve it by following these steps:

  • Click on "Settings" in the Windows Start menu.
  • Navigate to "Time & Language" within the Settings menu.
  • Select "Date & Time" from the Time & Language options.
  • Click on "Additional Settings."
  • Finally, select "Sync now" to synchronize your system's date and time settings.

image

This fixed my issue, You can give it a try.

thanks a tonn manhh

@PhucHung2k1
Copy link

i can'f fix it. help me pls..
image

@bhaski2003
Copy link

bhaski2003 commented Nov 30, 2023 via email

@PhucHung2k1
Copy link

You should go to 'Date and time' settings on windows and there 'Sync now' If this doesn't work then , try turning off/on the 'set automatic time' and 'select automatic timezone' for both try turning off/on and try also with sync now :))

On Thu, 30 Nov, 2023, 1:39 pm PhucHung2k1, @.> wrote: i can'f fix it. help me pls.. image.png (view on web) https://github.com/adrianhajdin/threads/assets/124114709/4c96636b-81a6-4260-9d96-02e54e82d4fd — Reply to this email directly, view it on GitHub <#86 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWZGTS5Y5T62AATOHBWQ4D3YHA5NFAVCNFSM6AAAAAA5KONN2SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZTGI4DKMRYGU . You are receiving this because you commented.Message ID: @.>

image
it take long time and doesn't work again :((

@bhaski2003
Copy link

bhaski2003 commented Nov 30, 2023 via email

@Ankitsharma991
Copy link

@FredDaFed sudo apt install ntpupdate && sudo ntpdate pool.ntp.org
this command is not working, showing cannot locate packages for ntpupdate.
So, can you share another way?
for now, what i did to prevent this error is, i just delete my account relogin and use the tokens. and that's how it is working but the problem is till when i need to do like this only??

@Aaryan123456679
Copy link

I am using Mac and facing this error what steps would work ?

@bhaski2003
Copy link

Please refer my above instructions , prolly a mismatch btw time in ur system and time in server

@Bright-200
Copy link

I change my localhost:3000 to another option such as localhost3001 and it worked.

@huntfpoly12
Copy link

Screenshot 2024-01-02 144436
I fixed it by turning everything on as in the picture and clicking "sync now".

@Drake669
Copy link

Drake669 commented Jan 4, 2024

If you are mac, you can go to your date and time settings and then check the box for "set date and time automatically" if its and unchecked and uncheck if its checked. This fixed it for me

@ManuWeb3
Copy link

ManuWeb3 commented Jan 5, 2024

Found the issue with my system.
My local instance of WSL Ubunbtu has a time lag of an hour.
That's the reason it's getting messed up with the Clerk JWT token thing.

Now, I'm browing net/using ChatGPT to fix the time clock of WSL on my Windows system

@ManuWeb3
Copy link

ManuWeb3 commented Jan 5, 2024

My issue resolved. Removed systemd-timesyncd and installed ntp. That synced my WSL time with the correct network time and I got rid of the error.

@Elee-Lawleit
Copy link

Does anyone know how to handle this error accurately on the application level? Does it appear in production?

@moschan
Copy link

moschan commented Jan 18, 2024

Under the mac OS. I tried this command to force to sync my machine time.

sudo sntp -Ss time.asia.apple.com

Then issued fixed, for my case.

@Danin1993
Copy link

Well i fix it but i dont rly know how.

  1. Update windows install all updates.
  2. https://www.worldtimeserver.com/atomic-clock/
  • ping google.com
  • ping 8.8.8.8
  • ping time.windows.com
  1. https://www.youtube.com/watch?v=7KFJDFkiaAg

One ot this steps fix my issue in sync time.

this actually fixed it for me

@HugoFortunato
Copy link

HugoFortunato commented Jan 26, 2024

If you are using WSL with windows, it will be slightly off.

ISSUE: image

SOLUTION: If you go into your Ubuntu WSL terminal, the command below will fix the issue:

sudo apt install ntpupdate && sudo ntpdate pool.ntp.org

RESULTS: 9 Oct 06:46:10 ntpdate[31661]: step time server 129.250.35.250 offset +148.127650 sec Restart your server then it should work as seen below: image After Signing in and accessing secured page: image

Checking home page after signing in: image

You should to update your command to make it works on terminal:

your command: sudo apt install ntpupdate && sudo ntpdate pool.ntp.org

correct command: sudo apt install ntpdate && sudo ntpdate pool.ntp.org

Now, it works for me! Thank you.

@devkypham
Copy link

Update your system time like here https://time.is/, I updated and fixed the error

@designbyhsn
Copy link

If you are in Windows 11 try these steps

1: Sync your time from the settings
2: Restart your Pc
3: Run your app
4: Open the inspect panel in the browser
5: Switch to storage
6: Delete all from localhost

inspect

@123Brijesh44aa
Copy link

123Brijesh44aa commented Mar 21, 2024

WORKING SOLUTION FOR WINDOWS :

Go To Services -> Windows Time -> Right click -> Start
Again Go to Services -> Windows Time -> Right Click -> properties -> startup type -> automatic and then apply .

After that Go to Settings -> Date and Time -> Sync

@aiyaruch1320
Copy link

If you are using Windows 11 and encountering an error, you can attempt to resolve it by following these steps:

  • Click on "Settings" in the Windows Start menu.
  • Navigate to "Time & Language" within the Settings menu.
  • Select "Date & Time" from the Time & Language options.
  • Click on "Additional Settings."
  • Finally, select "Sync now" to synchronize your system's date and time settings.

image

This fixed my issue, You can give it a try.

it's work! thank

@harsh7800
Copy link

turning the "Set time Automatically" off worked for me :)

@dejoma
Copy link

dejoma commented Apr 9, 2024

I have this issue on Vercel... I deleted a user in Clerk auth, it was stored in the cookie and tried to use the cookie for logging in.

@henriquedevelops
Copy link

I get this error all the time, I usually speed up the timer and stop this error but I think it is something clerk is trying to fix

hey @MatthewAraujo , could you please tell what do you mean by "speed up the timer"?

@thuongtruong1009
Copy link

thuongtruong1009 commented May 7, 2024

If you are using Windows 11 and encountering an error, you can attempt to resolve it by following these steps:

  • Click on "Settings" in the Windows Start menu.
  • Navigate to "Time & Language" within the Settings menu.
  • Select "Date & Time" from the Time & Language options.
  • Click on "Additional Settings."
  • Finally, select "Sync now" to synchronize your system's date and time settings.

image

This fixed my issue, You can give it a try.

thank you very much, It works for me! 💖

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