Unable to build docs with 2.x (`Cannot read properties of null`)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 25.9k
- Forks
- 2.4k
- Avg merge
- 13h 10m
- Merged PRs (30d)
- 4
Description
Describe the bug
After updating @redocly/cli from 1.34.4 to 2.0.2 I'm unable to build API documentation
To Reproduce
Steps to reproduce the behavior:
- Run this command:
npx redocly build-docs openapi.yaml - See error
Prerendering docs Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem. TypeError: Cannot read properties of null (reading 'useRef')
Expected behavior
Redocly 2.0.2 should build documentation, just like 1.34.4 does
OpenAPI description
I'm aware that this issue may be related to the specific openapi.yaml file, however I'd prefer to not share it
Redocly Version(s)
2.0.2
Node.js Version(s)
22.15.0
OS, environment
Windows
Additional context
None
Contributor guide
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 reproducing npx redocly build-docs openapi.yaml with Redocly 2.0.2 and compare it with 1.34.4 using an available OpenAPI description. Investigate the prerendering step and the reported React useRef failure, then confirm that the same documentation build completes successfully without the invalid-hook warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, openapi, react
- Domain
- api, documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100