matrix-appservice-irc icon indicating copy to clipboard operation
matrix-appservice-irc copied to clipboard

config: tlsOptions property fails schema validation

Open jkhsjdhjs opened this issue 3 years ago • 1 comments

When attempting to generate a registration file, the config is validated against its schema. This fails for me because of the following error:

The field data.ircService.servers[keys2.0].tlsOptions is null which is the wrong type
/usr/lib/node_modules/matrix-appservice-irc/node_modules/matrix-appservice-bridge/lib/components/config-validator.js:77
            throw e;
            ^

Error: Failed to validate file
    at ConfigValidator.validate (/usr/lib/node_modules/matrix-appservice-irc/node_modules/matrix-appservice-bridge/lib/components/config-validator.js:75:23)
    at Cli.loadConfig (/usr/lib/node_modules/matrix-appservice-irc/node_modules/matrix-appservice-bridge/lib/components/cli.js:184:26)
    at Cli.assignConfigFile (/usr/lib/node_modules/matrix-appservice-irc/node_modules/matrix-appservice-bridge/lib/components/cli.js:164:29)
    at Cli.run (/usr/lib/node_modules/matrix-appservice-irc/node_modules/matrix-appservice-bridge/lib/components/cli.js:140:22)
    at Object.<anonymous> (/usr/lib/node_modules/matrix-appservice-irc/app.js:79:4)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Module._load (node:internal/modules/cjs/loader:827:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47 {
  _validationErrors: [
    {
      field: 'data.ircService.servers[keys2.0].tlsOptions',
      message: 'is the wrong type',
      value: null,
      type: 'object',
      schemaPath: [
        'properties',
        'ircService',
        'properties',
        'servers',
        'additionalProperties',
        'properties',
        'tlsOptions'
      ]
    }
  ]
}

Node.js v18.0.0

The issue here is that tlsOptions isn't commented out by default, thus being present in the parent object and required to have an object as it's vaue by the schema. Commenting out tlsOptions fixes this issue.

jkhsjdhjs avatar Apr 30 '22 13:04 jkhsjdhjs

One more thing for next PR :-)

altf4arnold avatar Jan 25 '24 23:01 altf4arnold