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_API_KEYset 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.
- If you are handling instantiation of the Clerk object yourself, are you passing your server API key to the constructor via the
- In development mode, do your frontend & API reside on the same domain? Unless the clerk
__sessionis 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_LOGGINGenvironment variable to
trueto 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.