balderdashy/sails · error

E_INVALID_SESSION_SECRET

E_INVALID_SESSION_SECRET

Error message

If provided, sails.config.session.secret should be a string.

What it means

Error "If provided, sails.config.session.secret should be a string." thrown in balderdashy/sails.

Source

Thrown at lib/hooks/http/get-configured-http-middleware-fns.js:132

    })(),


    cookieParser: (function() {

      var cookieParser = sails.config.http.middleware.cookieParser;
      if (!cookieParser) {
        cookieParser = require('cookie-parser');
      }

      var sessionSecret = sails.config.session && sails.config.session.secret;

      // If available, Sails uses the configured session secret for signing cookies.
      if (sessionSecret) {
        // Ensure secret is a string.  This check happens in the session hook as well,
        // but sails.config.session.secret may still be provided even if the session hook
        // is turned off, so to be extra anal we'll check here as well.
        if (!_.isString(sessionSecret)) {
          throw flaverr({ name: 'userError', code: 'E_INVALID_SESSION_SECRET' }, new Error('If provided, sails.config.session.secret should be a string.'));
        }
        return cookieParser(sessionSecret);
      }
      // If no session secret was provided in config
      // (e.g. if session hook is disabled and config/session.js is removed)
      // then we do not enable signed cookies by providing a cookie secret.
      // (note that of course signed cookies can still be enabled in a Sails app:
      // see conceptual docs on disabling the session hook for info)
      else {
        return cookieParser();
      }
    })(),

    compress: IS_NODE_ENV_PRODUCTION && require('compression')(),


    // Configures the middleware function used for parsing the HTTP request body, if enabled.
    bodyParser: (function() {

View on GitHub (pinned to 7b76422cc2)

When it happens

Trigger: Thrown at lib/hooks/http/get-configured-http-middleware-fns.js:132 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of balderdashy/sails@7b76422cc2 (2026-09-01). Data as JSON: /api/errors/4e8f8f9c9f55205a. Report an issue: GitHub.