Error when running `yarn generate-adaptors`
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 23
- Forks
- 20
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 6
Description
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 ''
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running yarn generate-adaptors and inspect sidebars-adaptors.js around lines 89-91. Trace which overview record produces an empty id and determine whether the source data or sidebar generation is responsible. Done means the underlying cause is addressed and the command completes without the Docusaurus sidebar validation error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100