Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.devGet API keys

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_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.
  • If you are handling instantiation of the Clerk object yourself, are you passing your server API key to the constructor via the apiKey option?
  • 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 to true 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.

Was this helpful?

Clerk © 2022