Failed to load PDF file error with react-pdf

I am trying to load a pdf using react-pdf. I know the file and the path are correct because the pdf did load when I used an embed HTML tag. In the browser, I only see “Failed to Load Pdf File”. And in the console I see “Warning: Setting up fake worker.” What am I doing wrong?


import { Document, Page } from "react-pdf";
import MichaelPanel from "../../Assets/images/MichaelPanel.pdf";
  const [numPage, setNumPages] = useState(null);
  const [pageNumber, setPageNumber] = useState(1);

  const onDocumentLoadSuccess = ({ numPages }) => {
    setNumPages(numPages);
  };
    <Document file={MichaelPanel} onLoadSuccess={onDocumentLoadSuccess}>
                          <Page pageNumber={pageNumber} />
                        </Document>