balderdashy/sails · error

E_INVALID

E_INVALID

Error message

Must specify a non-empty string, but instead got: ${util.inspect(originUrl, {depth: null})}

What it means

Error "Must specify a non-empty string, but instead got: ${util.inspect(originUrl, {depth: null})}" thrown in balderdashy/sails.

Source

Thrown at lib/util/check-origin-url.js:26

var util = require('util');


/**
 * checkOriginUrl()
 *
 * @param {String} originUrl
 *        The origin URL to check.
 *        (This is used when parsing the relevant config from within `sails.config.security`
 *         or `sails.config.sockets`.)
 *
 * @throws {Error} if not valid
 *   @property {String} code  (==='E_INVALID')
 */

module.exports = function checkOriginUrl(originUrl) {

  if (!_.isString(originUrl) || originUrl === '') {
    throw flaverr('E_INVALID', new Error('Must specify a non-empty string, but instead got: '+util.inspect(originUrl, {depth: null})));
  }

  if (!originUrl.match(/^https?:\/\//)) {
    throw flaverr('E_INVALID', new Error('Must specify a protocol like http:// or https://, but instead got: '+originUrl));
  }

  // Now do a mostly-correct parse of the URL.
  var parsedOriginUrl = url.parse(originUrl);

  var isHttps = parsedOriginUrl.protocol === 'https:';

  if (isHttps && parsedOriginUrl.port === '443') {
    throw flaverr('E_INVALID', new Error('Should not explicitly specify port 443 with https:// (it is implied).  But instead got: '+originUrl));
  }
  if (!isHttps && parsedOriginUrl.port === '80') {
    throw flaverr('E_INVALID', new Error('Should not explicitly specify port 80 with https:// (it is implied).  But instead got: '+originUrl));
  }

View on GitHub (pinned to 7b76422cc2)

When it happens

Trigger: Thrown at lib/util/check-origin-url.js:26 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/b640efcfd957b769. Report an issue: GitHub.