Next.js Discord

Discord Forum

404 Not found despite it being deployed

Answered
ihyd posted this in #help-forum
Open in Discord
I don't understand why I can't access the website despite it showing that it deployed properly without any errors
Answered by ihyd
View full answer

72 Replies

bump
bump 2 :(
Greenish Elaenia
Are you using the /app or /pages file structure?
It should load the page.tsx at /app and the layout.tsx at /app
Greenish Elaenia
at the /app folder, is there a page.tsx and a layout.tsx?
yep ofcourse
I don't think the issue is with that, it works perfectly fine locally
including when i build and then run the built website
but only on vercel it returns 404
Greenish Elaenia
Oh I see
Greenish Elaenia
When is the 404 occuring? What page did you navigate to, that triggers the error?
that's the issue
Greenish Elaenia
Might be a path issue when passed to router
Can you paste one of the fetch('...') statements?
Greenish Elaenia
for example:
const resp = await fetch(/api/counters/read-counter?app=mantraapp&name=${name}, {
method: 'GET'
});
if (resp.status == 200) {
const json = await resp.json();
console.log("fetch returned counters: ", json.counters.rows)
setGlobalCount(Number(json.counters.rows[0].count));
} else {
console.error("status", resp.status, "statusText", resp.statusText);
const json = await resp.json();
console.log("fetch returned counters: ", json.counters.rows)
}
i don't get it what does fetch have to do with it
i'm only fetching API routes
Greenish Elaenia
Recently had an issue similar to yours where the api routes worked locally for me but not after deployed, was because the fetch included base url and this doesnt work online but does work locally
I understand the API routing thing haha i've hosted on vercel before
that's why this is confusing for me
i'm not fetching anything, even the base website doesnt load
with 0 errors
do you have anything hosted on vercel rn?
Greenish Elaenia
Yeah I have a nextjs stable on Vercel hobby plan, it's a small applet + lightweight crm in the works
would you mind going to the specific deployment and showing me the source?
Greenish Elaenia
Maybe the domain changed or you might find something in Runtime logs
for some reason it shows only these in my source
so that could be the issue? or maybe that's normal
the output is just the pictures
Greenish Elaenia
I deployed mine straight from Github repo, how are you doing pipeline?
github
same thing
oh hold on
Answer
i think that's hy
no framework detected
they couldn't just send that as an error? 😭
let me try to fix
jesus christ if that's the issue..
Greenish Elaenia
@ihyd Click to see attachment
^^ hold on
i'm testing
andddddd
it worked...
😭
i'm just stupid I guess
Greenish Elaenia
Probably first time build didnt correctly bundle nextjs
seriously how can vercel not detect their own framework??
Greenish Elaenia
Nice you figured it out
it's such a small thing to notice
alright now to actually code the website
Greenish Elaenia
I went back and tried deploying a repo - sometimes the website doesnt detect a framework and selects "Other"
Greenish Elaenia
my project very clearly has next.js associated
Greenish Elaenia
This is the same repo I have already deployed so I know it has nextjs working
are you good with Prisma btw?
Greenish Elaenia
It autodetected as Other, not Nextjs, but can manually change the dropdown
pls tell me u know prisma
im gonna lose my bananas
@ihyd are you good with Prisma btw?
Greenish Elaenia
Idk Prisma yet, srry - you want to open a new post for that probably
Remember to mark this one as solved
i'll just work on prisma by myself
thanks for the help man