{"record":{"id":"4e8f8f9c9f55205a","repo":"balderdashy/sails","slug":"e-invalid-session-secret","errorCode":"E_INVALID_SESSION_SECRET","errorMessage":"If provided, sails.config.session.secret should be a string.","messagePattern":"If provided, sails\\.config\\.session\\.secret should be a string\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/hooks/http/get-configured-http-middleware-fns.js","lineNumber":132,"sourceCode":"    })(),\n\n\n    cookieParser: (function() {\n\n      var cookieParser = sails.config.http.middleware.cookieParser;\n      if (!cookieParser) {\n        cookieParser = require('cookie-parser');\n      }\n\n      var sessionSecret = sails.config.session && sails.config.session.secret;\n\n      // If available, Sails uses the configured session secret for signing cookies.\n      if (sessionSecret) {\n        // Ensure secret is a string.  This check happens in the session hook as well,\n        // but sails.config.session.secret may still be provided even if the session hook\n        // is turned off, so to be extra anal we'll check here as well.\n        if (!_.isString(sessionSecret)) {\n          throw flaverr({ name: 'userError', code: 'E_INVALID_SESSION_SECRET' }, new Error('If provided, sails.config.session.secret should be a string.'));\n        }\n        return cookieParser(sessionSecret);\n      }\n      // If no session secret was provided in config\n      // (e.g. if session hook is disabled and config/session.js is removed)\n      // then we do not enable signed cookies by providing a cookie secret.\n      // (note that of course signed cookies can still be enabled in a Sails app:\n      // see conceptual docs on disabling the session hook for info)\n      else {\n        return cookieParser();\n      }\n    })(),\n\n    compress: IS_NODE_ENV_PRODUCTION && require('compression')(),\n\n\n    // Configures the middleware function used for parsing the HTTP request body, if enabled.\n    bodyParser: (function() {","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/balderdashy/sails/blob/7b76422cc27823df033572bdda5c4910a68b697f/lib/hooks/http/get-configured-http-middleware-fns.js#L114-L150","documentation":"Error \"If provided, sails.config.session.secret should be a string.\" thrown in balderdashy/sails.","triggerScenarios":"Thrown at lib/hooks/http/get-configured-http-middleware-fns.js:132 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b76422cc27823df033572bdda5c4910a68b697f","analyzedAt":"2026-09-01T04:01:57.104Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}