PaloAltoNetworks / PaloAltoNetworks/docusaurus-openapi-docs

Uncaught Runtime Errors

Open
#843 18 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation question
Dominant language
TypeScript
Stars
1.1k
Forks
315
Avg merge
7d 5h
Merged PRs (30d)
7

Description

Describe the bug

I am trying to integrate this package into my existing docusaurus documentation and i'm running into issues with running the docs. I get this error everytime i load/serve it up and sometimes as soon as i click on the sidebar that contains the API

Expected behavior

I expect it to work as usual. I expect it to load up the mdx generated pages

Current behavior

It's currently throwing an error. I've tried different combinations of versions, it's still not working.

Steps to reproduce

Screenshots

Screenshot 2024-06-21 at 14 07 12

Your Environment

First Version

 "@docusaurus/core": "3.4.0",
    "@docusaurus/preset-classic": "3.4.0",
    "@mdx-js/react": "^3.0.0",
    "prism-react-renderer": "2.3.0",
    "docusaurus-plugin-openapi-docs": "3.0.0-beta.10",
    "docusaurus-theme-openapi-docs": "3.0.0-beta.10",

Second Version

  "@docusaurus/core": ">=2.4.1 <=2.4.3",
    "@docusaurus/preset-classic": ">=2.4.1 <=2.4.3",
    "@mdx-js/react": "^1.6.22",
    "clsx": "^1.1.1",
    "docusaurus-plugin-openapi-docs": "2.1.0",
    "docusaurus-theme-openapi-docs": "2.1.0",

my docusaurus.config.js file


// import { themes as prismThemes } from 'prism-react-renderer';

const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');

/** @type {import('@docusaurus/types').Config} */
const config = {
  title: 'title',
  tagline: '',
  url: 'url',
  baseUrl: '/',
  onBrokenLinks: 'throw',
  onBrokenMarkdownLinks: 'warn',
  favicon: 'img/favicon.ico',

  // Even if you don't use internalization, you can use this field to set useful
  // metadata like html lang. For example, if your site is Chinese, you may want
  // to replace "en" with "zh-Hans".
  // i18n: {
  //   defaultLocale: 'en',
  //   locales: ['en'],
  // },

  presets: [
    [
      'classic',
      /** @type {import('@docusaurus/preset-classic').Options} */
      ({
        docs: {
          sidebarPath: require.resolve('./sidebars.js'),
          // docRootComponent: '@theme/DocRoot',
          docLayoutComponent: '@theme/DocPage',
          docItemComponent: '@theme/ApiItem',
        },
        theme: {
          customCss: require.resolve('./src/css/custom.css'),
        },
      }),
    ],
  ],
  plugins: [
    [
      'docusaurus-plugin-openapi-docs',
      {
        id: 'docs', // plugin id
        docsPluginId: 'classic', // id of plugin-content-docs or preset for rendering docs
        config: {
          lebowski: {
            specPath: '../lebowski/open-api/adrequest-proxy-spec.yaml',
            outputDir: 'docs/ad-request-proxy/OpenAPI',
            sidebarOptions: {
              // optional, instructs plugin to generate sidebar.js
              groupPathsBy: 'tag', // group sidebar items by operation "tag"
            },
          },
        },
      },
    ],
  ],

  themeConfig:
    /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
    ({
      navbar: {
        title: 'AdTech docs',
        logo: {
          alt: 'My Site Logo',
          src: 'img/logo.svg',
        },
        items: [
          {
            href: 'ref_link',
            label: 'GitHub',
            position: 'right',
          },
        ],
      },
      footer: {
        style: 'dark',
        links: [
          {
            title: 'Getting started',
            items: [
              {
                label: 'Getting started',
                to: '/docs/intro',
              },
            ],
          },
          {
            title: 'Github',
            items: [
              {
                label: 'AdTech monorepo',
                href: 'ref_link',
              },
              {
                label: 'Proxy Ads',
                href: 'ref_link',
              },
              {
                label: 'Proxy Events',
                href: 'ref_link',
              },
            ],
          },
          {
            title: 'Related documentation',
            items: [
              {
                label: 'Kevel API docs',
                to: 'https://dev.kevel.com/reference/request',
              },
            ],
          },
        ],
      },
      prism: {
        // theme: prismThemes.github,
        // darkTheme: prismThemes.dracula,
        theme: lightCodeTheme,
        darkTheme: darkCodeTheme,
      },
    }),
  themes: ['docusaurus-theme-openapi-docs'],
};

module.exports = config;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the docusaurus.config.js configuration and the listed Docusaurus, OpenAPI plugin, theme, and React-related versions. Run the documented setup and serve the generated API pages, including navigation through the API sidebar, to reproduce the uncaught runtime error. Done means the MDX-generated pages load without errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi, react
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.