Vercel deployment failure with App Directory!
Unanswered
Havana posted this in #help-forum
HavanaOP
I cannot deploy my project to Vercel, with app directory.
I have set all env variables right, such as in my local .env.local i have the local host as the value and in Vercel i have my actual domain as value to NEXT_PUBLIC_API_URL key.
Here's my project it's a small one. Im also not sure if i have the correct folder structure.
https://github.com/KukR1/blog-markdown-ktsoumas
In my localhost everything is working fine but something is wrong either with api routes or tha page.tsx where the app is mounting as i am trying to SSR there.
This is where I am getting the data for /app/page.tsx
/helpers/useGetBlogInfo.ts:
The error from Vercel:
I have set all env variables right, such as in my local .env.local i have the local host as the value and in Vercel i have my actual domain as value to NEXT_PUBLIC_API_URL key.
Here's my project it's a small one. Im also not sure if i have the correct folder structure.
https://github.com/KukR1/blog-markdown-ktsoumas
In my localhost everything is working fine but something is wrong either with api routes or tha page.tsx where the app is mounting as i am trying to SSR there.
This is where I am getting the data for /app/page.tsx
/helpers/useGetBlogInfo.ts:
export const useGetBlogInfo = async () => {
const url =${process.env.NEXT_PUBLIC_API_URL}/api/getInfo;
console.log(Fetching data from URL: ${url});
const res = await fetch(url, {
cache: 'no-store',
});
if (!res.ok) {
console.error('Response not OK:', await res.text());
throw new Error(HTTP error! status: ${res.status});
}
const json = await res.json();
console.log('Fetched data:', json);
return json;
};The error from Vercel:
Error: HTTP error! status: 404
at useGetBlogInfo (/vercel/path0/.next/server/app/page.js:340:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Home (/vercel/path0/.next/server/app/page.js:376:30)
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
Error: HTTP error! status: 404
at useGetBlogInfo (/vercel/path0/.next/server/app/page.js:340:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Home (/vercel/path0/.next/server/app/page.js:376:30)