Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to render Redoc page using the HTML Tag #2512

Open
ShivamBang98 opened this issue Apr 17, 2024 · 0 comments
Open

Unable to render Redoc page using the HTML Tag #2512

ShivamBang98 opened this issue Apr 17, 2024 · 0 comments

Comments

@ShivamBang98
Copy link

ShivamBang98 commented Apr 17, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant