swagger-api / swagger-api/swagger-ui
TypeError: Cannot read properties of undefined (reading 'match')
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Error loading content from the uploaded file. Detail is that the content of the file is read in the frontend, below the source code and screenshot of the error
Q&A (please complete the following information)
- OS: Linux
- Browser: Firefox
- Version: 106.0.5
- Method of installation: npm
- Swagger-UI version: 4.14.2
- Swagger/OpenAPI version: OpenAPI 3.0
Screenshots

Content & configuration
Source code example:
import { useState } from "react";
import SwaggerUI from "swagger-ui-react";
import "swagger-ui-react/swagger-ui.css";
function App() {
const [file, setFile] = useState();
const handleChange = (e) => {
const fileReader = new FileReader();
fileReader.readAsText(e.target.files[0], "UTF-8");
fileReader.onload = (e) => {
setFile(e.target.result);
};
};
return (
<div>
<h2>Error Swagger Console</h2>
<input type="file" onChange={handleChange} />
{file && <SwaggerUI spec={file} />}
</div>
);
}
export default App;
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 provided React App example and reproduce the failure by selecting an uploaded file in Firefox. Trace how the FileReader result is passed through the SwaggerUI spec prop, then define completion as loading the uploaded OpenAPI 3.0 content without the reported TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100