Next.js Discord

Discord Forum

Stop Vercel Dynamically Storing Public Files

Answered
Giant panda posted this in #help-forum
Open in Discord
Avatar
Giant pandaOP
I have a 'download' button on my app, that references a PDF file in the public directory. This works fine when run locally, however when deployed to vercel it does not.

When trying to access 'http://domain.com/FILENAME' it does not work for this file, but does work for all the other image files stored in the public folder that are used in my app.

I read that Vercel does this on purpose?

Any suggestions?
Answered by Anay-208
I had to set this
    "functions": {
        "api/*": {
            "includeFiles": "docs/**/*"
        }
    }
View full answer

13 Replies

Avatar
i faced this issue before with a app(it wasn't nextjs, so confirm), I had to add that path to vercel config. you can check out vercel config
Avatar
Giant pandaOP
appreciate it - any chamnce you remember where abouts?
https://vercel.com/docs/projects/project-configuration
Avatar
I had to set this
    "functions": {
        "api/*": {
            "includeFiles": "docs/**/*"
        }
    }
Answer
Avatar
I'm unsure if its same for nextjs.
Avatar
Giant pandaOP
alright, cheers i appreciate the help
Avatar
please verify if it is working first, and lmk
Avatar
Giant pandaOP
Unfortunately not, as I have no severless functions I'm trying to reference,
Avatar
Umm, I'll have to check this locally first. will do that tmr and let you know
Avatar
Giant pandaOP
cheers
Avatar
@Giant panda I tried it, and its working fine for me
Image
I'm able to view the PDF after deploying to vercel
Avatar
@Giant panda
Avatar
Giant pandaOP
Hi - so sorry for the delay, I got this woking using your help. Thank you so much!