Next.js Discord

Discord Forum

Error: ENOENT: no such file or directory. Error occurred prerendering page /test.dev.com:3000/{slug}

Unanswered
Common Snipe posted this in #help-forum
Open in Discord
Common SnipeOP
Hello, I'm using the platforms starter kit to standup a blog platform and I'm running into an issue. When building locally I keep getting this error on the dynamic page route where I have parallel routes as children. Everything runs fine locally but just won't build. The error message is not very helpful and I can't seem to narrow it down. It seems like it's trying to prerender a page like "domain.com/test.dev.com:3000/slug" when it should just be "test.dev.com/slug". Can anyone help me with this?

4 Replies

Common SnipeOP
I've narrowed it down to the getStaticParams function on the dynamic route. It seems adding the "domain" field in the returned array makes it fail the build. Code example: export async function generateStaticParams() { const allPosts = await prisma.post.findMany({ select: { slug: true, site: { select: { subdomain: true, customDomain: true, }, }, }, }); const allPaths = allPosts // @ts-ignore .flatMap(({ site, slug }) => [ site?.subdomain && { domain:${site.subdomain}.${process.env.NEXT_PUBLIC_ROOT_DOMAIN}, slug, }, site?.customDomain && { domain: site.customDomain, slug, }, ]) .filter(Boolean); return allPaths; }
Pyramid ant
Hi @Common Snipe
I have an issue with this Platform Starter Kit on deployment i get 404 error but deployment to production in vercel was successful, did you face this error and how do you think it can be resolved?
Common SnipeOP
Hi @Pyramid ant , sorry for the delayed response. I feel like I did have that issue. You're talking about the preview deployment branches? I think I may still have this issue. Haven't worked on this in a bit, I'll update you if I find something
Pyramid ant
Okay @Common Snipe ...thank you