PaloAltoNetworks / PaloAltoNetworks/docusaurus-openapi-docs

URL Function Undefined

Open
#1,116 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug reviewing :eyes:
Dominant language
TypeScript
Stars
1.1k
Forks
315
Avg merge
7d 5h
Merged PRs (30d)
7

Description

Describe the bug

When using the docusaurus-openapi-docs plugin, the global URL constructor is undefined. This breaks code that depends on URL, such as the Microsoft Authentication Library for React (msal-react) loginPopup in my application.

Observations:

  • When disabling the docusaurus-openapi-docs plugin, URL is properly defined.
  • This issue occurs when customizing the ApiItem component in the plugin's theme.

Expected behavior

The global URL constructor should be defined and accessible in the same way as in a default Docusaurus environment.

Current behavior

  • URL is undefined inside the customized ApiItem component from the docusaurus-openapi-docs plugin. It is probably same for other components.
  • URL is defined correctly when using the standard DocItemLayout from @docusaurus/theme-classic.

Possible solution

The URL constructor may be overwritten or removed by some internal logic in the plugin.

Steps to reproduce

  1. Copy the ApiItem folder from docusaurus-theme-openapi-docs/src/theme into yoursrc/theme folder.
  2. Inside src/theme/ApiItem/Layout.js, add:
console.log("URL:", URL);
  1. Run the project.
  2. Observe that URL is undefined.
Compare without the plugin
  1. Uninstall the docusaurus-openapi-docs plugin.
  2. Copy the DocItem folder from @docusaurus/theme-classic/lib/theme/DocItem/Layout into src/theme.
  3. Add the same console log inside the component.
  4. Observe that URL is now correctly defined.

Console Output (with docusaurus-openapi-docs enabled):

URL: undefined

Console Output (with docusaurus-openapi-docs disabled):

URL: ƒ URL() { [native code] }

Context

This issue breaks Microsoft Authentication Library for React (msal-react) loginPopup method, which internally depends on URL. The issue blocks the authentication flow in my application.

Your Environment

  • Version used: docusaurus-openapi-docs (latest version at the time of writing)
  • Docusaurus version: 3.7.0
  • Environment name and version: Chrome Version 134.0.6998.119 (Official Build) (arm64), Node.js v22.14.0
  • Operating System and version: macOS Sequoia 15.0.1

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 copied src/theme/ApiItem/Layout.js and reproduce the console.log("URL:", URL) result with the docusaurus-openapi-docs plugin enabled. Compare it with the copied DocItem layout from @docusaurus/theme-classic and trace where the global URL differs. Done means URL is defined in the customized ApiItem component and the reported msal-react loginPopup flow is no longer blocked.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.