Skip to main content
Which UI do you use?
Custom UI
Pre built UI

How to enable debug logs

Enable backend logs#

important

This is only available on versions:

  • supertokens-node >= v9.1.2
  • supertokens-golang >= v0.5.5
  • supertokens-python >= v0.6.3

Our backend SDK provides useful logs that can help with debugging. To enable logging, you need to run the SDK in debug mode:

DEBUG=com.supertokens node index.js

# OR

DEBUG=com.supertokens npm start

# OR

DEBUG=com.supertokens yarn start

Logs on your terminal have the following shape:

com.supertokens {"t": "2022-04-09T08:44:49.057Z", "sdkVer": "...", "message": "Started SuperTokens with debug logging (supertokens.init called)", "file": "..."}
  • t: The time the log was generated
  • sdkVer: Version of the SDK you are using
  • message: The log message
  • file: The file and line number from where this log was generated.

For non-serverless env#

You should see a few logs as soon as you start your backend process in debug mode. If you do not see them, it means:

  • Either the env var was not set properly
  • supertokens.init was not called on the backend. You must call the init function for the SDK to work as intended.

For serverless env#

You should see logs as soon as you make at least one API request in to a function that calls supertokens.init. If you don't see that, it means:

  • Either the env var was not set properly
  • You missed calling supertokens.init for the serverless function. You must call the init function for the SDK to work as intended.

Enable frontend logs#

Add enableDebugLogs when calling the init function:

import React from 'react';
import SuperTokens from "supertokens-auth-react";

SuperTokens.init({
enableDebugLogs: true,
appInfo: { /*...*/ },
recipeList: [/*...*/]
});

The above will print out supertokens debug log on the browser console:

Frontend browser debug logs
Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI