Can't load PDF on static Astro site

I’m trying to include a couple of pdfs on my static Astro 3.5.6 site, for example the CV at

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 ( 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: {

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.

@jheredos I don’t work with Astro so can’t advise how to rectify, but if you download the “PDF”:

Then open it as text, you’ll find that it contains only the string:


You could try running your build locally, (not your development command), and seeing what is output there.

The real PDF does appear to be at that location too, so perhaps it’s supposed to be a redirect?:

Thanks @nathanmartin. Paying attention to the build output helped me figure it out.

Turns out I was over-complicating it by trying to use Astro endpoints. Just including the pdfs in my /public directory was sufficient for them to get included in the root level of the build output. All I needed to do was remove the endpoint files.

awesome. thanks for sharing!