I’m trying to include a couple of pdfs on my static Astro 3.5.6 site, for example the CV at darling-sundae-ffe44b.netlify.app/cv.
I’ve done everything more or less exactly as in the examples in the Astro docs, and I have no issues when testing locally, but when I try to open the link (https://darling-sundae-ffe44b.netlify.app/jackson-cv.pdf) on the deployed site I get “Error Failed to load PDF document.” (Brave and Chrome) or an empty pdf viewer (Safari).
This is the the file (src/pages/jackson-cv.pdf.js) for my static file endpoint.
import CV from '../../public/jackson-cv.pdf';
export async function GET() {
return new Response(
new Blob([CV], { type: 'application/pdf' }),
{
headers: {
'Content-Type':'application/pdf',
}
}
);
}
I’ve also tried sending it as an array buffer instead of a Blob, or omitting the headers. Everything works locally but fails after deploying.