Skip to content

Error when running yarn generate-adaptors #682

@mtuchi

Description

@mtuchi

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 ''

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions