Unable to render Redoc page using the HTML Tag
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 25.9k
- Forks
- 2.4k
- Avg merge
- 13h 10m
- Merged PRs (30d)
- 4
Description
Hey everyone! I'm new to Redoc, and I'm trying to use the HTML tag to render my Open API spec, I'm unable to do so. I know the spec is correct, cause I took it directly from the sample swagger page at https://swagger.io/docs/specification/basic-structure/
Describe the bug
My HTML page is as follows:
<!DOCTYPE html>
<html>
<head>
<title>Redoc</title>
<!-- needed for adaptive design -->
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
<!--
Redoc doesn't change outer page styles
-->
<style>
body {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<redoc spec-url="/Users/shivambang98/api-docs/spec.yaml"></redoc>
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"> </script>
</body>
</html>
And upon opening it Chrome I get the following error:
Something went wrong...
i.lstatSync is not a function
Stack trace
Error: i.lstatSync is not a function
at t.BaseResolver.<anonymous> (https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js:2:31063)
at Generator.next (<anonymous>)
at https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js:2:29037
at new Promise (<anonymous>)
at r (https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js:2:28782)
at t.BaseResolver.loadExternalRef (https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js:2:30672)
at t.BaseResolver.<anonymous> (https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js:2:31576)
at Generator.next (<anonymous>)
at https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js:2:29037
at new Promise (<anonymous>)
ReDoc Version: 2.1.3
Commit: b2d8e0f
Expected behavior
The document should be rendered as per the spec in the YAML file.
Been stuck on this for a day and I'm unable to find any resolution, so any help would be very much appreciated!
Edit - The end goal for me is to be able to host this on kubernetes, and I wanted to take the easiest route possible, which for me is serving this HTML over an nginx server. If there are other alternatives, do let me know about those as well!
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 with the HTML page in the report, the spec-url value pointing to spec.yaml, and the redoc.standalone.js CDN bundle. Reproduce the failure from an nginx-served page rather than opening the file directly, then check whether the referenced specification can be loaded in that environment. Done means the OpenAPI document renders without the reported error; no repository file or test is identified in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100