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

Error: Not allowed to load local resource #1900

Closed
4 tasks done
LockeandDropit opened this issue Oct 15, 2024 · 2 comments
Closed
4 tasks done

Error: Not allowed to load local resource #1900

LockeandDropit opened this issue Oct 15, 2024 · 2 comments
Labels
bug Something isn't working stale

Comments

@LockeandDropit
Copy link

LockeandDropit commented Oct 15, 2024

Before you start - checklist

  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported
  • I have checked if an issue is not listed in Known issues
  • If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

I am unable to load a firestore URL as the source of the pdf viewer when in production mode. I get the error "Not allowed to load local resource" despite the resource being from cloud storage.

Steps to reproduce

const [resume, setResume] = useState(null)

const uploadToFirebase = async (x) => {

const storage = getStorage();
const resumeRef = ref(storage, "users/" + user.uid + "/resume.pdf");

const file = x;
await uploadBytes(resumeRef, file).then((snapshot) => {
  console.log("good to go")
})
.catch((e) => {
  console.log(e)
})

};

const downloadURL = async () => {
await getDownloadURL(resumeRef).then((response) => {
setResume(response);
})
.catch((error) => {
});
});
}

return (
<>
<PDFViewer src={resume ? resume : null} />
</>
)

Expected behavior

I expected the Document component to be able to render the pdf when given the URL.

Actual behavior

The Document component gave an error "Failed to load PDF file", with a console error stating "Error: Not allowed to load local resource".

Additional information

No response

Environment

  • Browser (if applicable): Brave v1.70.123
  • React-PDF version: ^9.1.0
  • React version: 18.2.0
  • Bundler name and version (if applicable):
@LockeandDropit LockeandDropit added the bug Something isn't working label Oct 15, 2024
Copy link
Contributor

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days.

@github-actions github-actions bot added the stale label Jan 27, 2025
Copy link
Contributor

This issue was closed because it has been stalled for 14 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

2 participants
@LockeandDropit and others