docs icon indicating copy to clipboard operation
docs copied to clipboard

Error when running `yarn generate-adaptors`

Open mtuchi opened this issue 6 months ago • 2 comments

Description I was getting the error below 👇🏽, when running yarn generate-adaptors.

ERROR] Sidebars file at "/Users/openfn/Workspace/docs/sidebars-adaptors.js" failed to be loaded.
[ERROR] Loading of version failed for version current

[ERROR] Error [ValidationError]: {
  "type": "doc",
  "label": "",
  "translatable": true,
  "id" [1]: ""
}

[1] "id" is not allowed to be empty
    at exports.process (/Users/openfn/Workspace/docs/node_modules/joi/lib/errors.js:193:16)
    at internals.entry (/Users/openfn/Workspace/docs/node_modules/joi/lib/validator.js:250:26)
    at exports.entry (/Users/openfn/Workspace/docs/node_modules/joi/lib/validator.js:27:30)
    at internals.Base.validate (/Users/openfn/Workspace/docs/node_modules/joi/lib/base.js:548:26)
    at internals.assert (/Users/openfn/Workspace/docs/node_modules/joi/lib/index.js:225:27)
    at Object.assert (/Users/openfn/Workspace/docs/node_modules/joi/lib/index.js:102:19)
    at validateSidebarItem (/Users/openfn/Workspace/docs/node_modules/@docusaurus/plugin-content-docs/lib/sidebars/validation.js:124:28)
    at Array.forEach (<anonymous>)
    at /Users/openfn/Workspace/docs/node_modules/@docusaurus/plugin-content-docs/lib/sidebars/validation.js:131:17
    at Array.forEach (<anonymous>) {
  _original: { type: 'doc', id: '', label: '', translatable: true },
  details: [
    {
      message: '"id" is not allowed to be empty',
      path: [ 'id' ],
      type: 'string.empty',
      context: { label: 'id', value: '', key: 'id' }
    }
  ]
}

I traced the root cause of the error to https://github.com/OpenFn/docs/blob/main/sidebars-adaptors.js#L89-L91

  const extras = overviews
    .filter(id => !adaptors.map(a => `${a.name}`).includes(id))
    .map(id => ({ type: 'doc', id, label: id }));

which was happening because id was '' for one of the record. I fixed it by checking if id && !adaptors.map(a => ${a.name}).includes(id) But i am not sure if this is the proper fix because we need to know why the id value is ''

mtuchi avatar Jul 08 '25 15:07 mtuchi

@josephjclark what should we do? Is it for the product team or Implementation team?

martalovescoffee avatar Jul 14 '25 07:07 martalovescoffee

Leave it for now. The next person to get sufficiently annoyed by it will fix it.

josephjclark avatar Jul 14 '25 10:07 josephjclark