Vercel how can I access static files outside of next.js directory?
Unanswered
style posted this in #help-forum
styleOP
Hi, I have a specific usecase. I've got monorepo with docs/ directory that contains static files i need to access in my client/'s (next.js app directory) api route.
However Vercel complains about files not being accessible:
What can i do to access them without placing them in /client?
However Vercel complains about files not being accessible:
Error: ENOENT: no such file or directory, open '/var/task/docs/index.json'
at async c (.next/server/app/api/docs/[...slug]/route.js:1:845)
at async l (.next/server/app/api/docs/[...slug]/route.js:1:9215) {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/var/task/docs/index.json'
}
const getIndexPath = () => path.join(process.cwd(), DOCS_DIRECTORY, "index.json");
export const DOCS_DIRECTORY = '../docs/';
What can i do to access them without placing them in /client?
1 Reply
I don't think you can access files like that in vercel, my guess would be using VPS.
I am not sure tho. been a while since I used vercel.
I am not sure tho. been a while since I used vercel.