Node.js SDK Troubleshooting
Especially when using the Clerk middleware, a number of common issues may occur.
Please consult the following check-list for some potential quick fixes:
- Is the
CLERK_SECRET_KEY
set in your environment? - In case you are using multiple Clerk apps or instances thereof (i.e. development, staging, production), ensure you are using the API key for the correct Clerk instance.
- In development mode, do your frontend & API reside on the same domain? Unless the clerk
__session
is sent to your API server, the SDK will fail to authenticate your user. - If you are still experiencing issues, it is advisable to set the
CLERK_LOGGING
environment variable totrue
to get additional logging output that may help identify the issue.
Note: The strict middleware variants (i.e. the "require auth" variants) will produce an erroneous response if the user is not signed in. Please ensure you are not mounting them on routes that are meant to be publicly accessible.