Hi! I have two separate NextJS projects both using Clerk. For some time now, Clerk is giving “clock skewed” errors for previously-logged-in users (but not for unlogged users), meaning I have to clear all cookies to make the website usable again, and I have to log in. Is there something going on, or is it my fault?
The exact error is
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 is expired. Expiry date: Sat, 26 Oct 2024 21:02:35 GMT, Current date: Wed, 20 Nov 2024 09:20:50 GMT. (reason=token-expired, token-carrier=cookie)
at (node_modules/@clerk/nextjs/dist/esm/server/authMiddleware.js:183:0)
at (node_modules/@clerk/nextjs/dist/esm/server/authMiddleware.js:74:0)
at (node_modules/next/dist/esm/server/web/adapter.js:158:0)
This is the middleware.ts file:
import { authMiddleware } from "@clerk/nextjs/server";
// See https://clerk.com/docs/references/nextjs/auth-middleware for more information about configuring your middleware
export default authMiddleware({
publicRoutes: [
"/",
"/chat",
"/legal/privacy-policy",
"/legal/terms-and-conditions",
"/api/(.*)",
],
ignoredRoutes: ["/api/clearCookies", "/api/campaign"],
});
export const config = {
matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
};
And the package.json:
{
"name": "deepscribes",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "next dev --turbo",
"build": "next build",
"start": "next start",
"lint": "next lint",
"lint:fix": "next lint --fix",
"format": "prettier --write --ignore-path .gitignore \"./**/*.{js,jsx,ts,tsx,json,css}\""
},
"dependencies": {
"@aws-sdk/client-s3": "^3.433.0",
"@aws-sdk/client-ses": "^3.679.0",
"@aws-sdk/lib-storage": "^3.677.0",
"@aws-sdk/s3-request-presigner": "^3.462.0",
"@clerk/localizations": "^1.26.7",
"@clerk/nextjs": "^4.23.3",
"@fontsource/inter": "^5.0.15",
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.1.1",
"@hocuspocus/provider": "^2.11.3",
"@radix-ui/react-dropdown-menu": "^2.0.5",
"@radix-ui/react-popover": "^1.0.6",
"@radix-ui/react-slot": "^1.0.2",
"@svgr/webpack": "^8.0.1",
"@tippyjs/react": "^4.2.6",
"@tiptap-pro/extension-drag-handle": "^2.7.6",
"@tiptap-pro/extension-drag-handle-react": "^2.7.6",
"@tiptap-pro/extension-emoji": "^2.7.6",
"@tiptap-pro/extension-file-handler": "^2.7.6",
"@tiptap-pro/extension-mathematics": "^2.7.6",
"@tiptap-pro/extension-node-range": "^2.7.6",
"@tiptap-pro/extension-table-of-contents": "^2.7.6",
"@tiptap-pro/extension-unique-id": "^2.7.6",
"@tiptap/core": "^2.2.4",
"@tiptap/extension-bullet-list": "^2.2.4",
"@tiptap/extension-character-count": "^2.2.4",
"@tiptap/extension-code-block": "^2.2.4",
"@tiptap/extension-code-block-lowlight": "^2.2.4",
"@tiptap/extension-collaboration": "^2.2.4",
"@tiptap/extension-collaboration-cursor": "^2.2.4",
"@tiptap/extension-color": "^2.2.4",
"@tiptap/extension-document": "^2.2.4",
"@tiptap/extension-dropcursor": "^2.2.4",
"@tiptap/extension-focus": "^2.2.4",
"@tiptap/extension-font-family": "^2.2.4",
"@tiptap/extension-heading": "^2.2.4",
"@tiptap/extension-highlight": "^2.2.4",
"@tiptap/extension-horizontal-rule": "^2.2.4",
"@tiptap/extension-image": "^2.2.4",
"@tiptap/extension-link": "^2.2.4",
"@tiptap/extension-ordered-list": "^2.2.4",
"@tiptap/extension-paragraph": "^2.2.4",
"@tiptap/extension-placeholder": "^2.2.4",
"@tiptap/extension-subscript": "^2.2.4",
"@tiptap/extension-superscript": "^2.2.4",
"@tiptap/extension-table": "^2.2.4",
"@tiptap/extension-table-header": "^2.2.4",
"@tiptap/extension-table-row": "^2.2.4",
"@tiptap/extension-task-item": "^2.2.4",
"@tiptap/extension-task-list": "^2.2.4",
"@tiptap/extension-text-align": "^2.2.4",
"@tiptap/extension-text-style": "^2.2.4",
"@tiptap/extension-typography": "^2.2.4",
"@tiptap/extension-underline": "^2.2.4",
"@tiptap/pm": "^2.2.4",
"@tiptap/react": "^2.2.4",
"@tiptap/starter-kit": "^2.2.4",
"@tiptap/suggestion": "^2.2.4",
"@types/node": "20.4.4",
"@types/react": "18.2.48",
"@types/react-dom": "18.2.18",
"@vercel/analytics": "^1.2.2",
"@vercel/speed-insights": "^1.0.10",
"autoprefixer": "10.4.14",
"axios": "^1.5.0",
"cal-sans": "^1.0.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"dotenv": "^16.3.1",
"drizzle-orm": "^0.28.5",
"eslint": "8.45.0",
"eslint-config-next": "^14.1.0",
"iframe-resizer": "^4.3.9",
"jsonwebtoken": "^9.0.1",
"lowlight": "^2.9.0",
"lucide-react": "^0.266.0",
"mime": "^4.0.0",
"nanoid": "^4.0.2",
"next": "^14.2.3",
"next-pwa": "^5.6.0",
"pg": "^8.11.3",
"postcss": "8.4.27",
"postgres": "^3.4.3",
"react": "^18.2.0",
"react-colorful": "^5.6.1",
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
"react-hot-toast": "^2.1.1",
"react-loading-skeleton": "^3.3.1",
"react-spinners": "^0.13.8",
"stripe": "^13.4.0",
"tailwind-merge": "^1.14.0",
"tailwindcss": "3.3.3",
"tailwindcss-animate": "^1.0.6",
"tippy.js": "^6.3.7",
"typescript": "5.1.6",
"uuid": "^9.0.0",
"y-prosemirror": "^1.2.3",
"yjs": "^13.6.14"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.9",
"@types/jsonwebtoken": "^9.0.2",
"@types/lodash.debounce": "^4.0.6",
"@types/node": "^20.8.7",
"@types/styled-components": "^5.1.15",
"@types/uuid": "^9.0.2",
"drizzle-kit": "^0.19.13",
"eslint-plugin-prettier": "^5.0.0",
"postcss-nesting": "^12.1.1",
"prettier": "^3.2.5",
"prettier-plugin-tailwindcss": "^0.5.14",
"vercel": "^34.1.8"
}
}
I’m not able to publicly share the repo with everyone, but I’m happy to share it with Vercel members.