[Error: Failed to collect page data for /api/auth/[...all]] coolify
I building my next.js app on coolify with nixpack but i get this error .
[Error: Failed to collect page data for /api/auth/[...all]]
what i can do ? @bekacru @Max
40 Replies
@Alex Yang
are there more logs?
yeah
sec
my versions btw :
"better-auth": "^1.3.6",
"next": "15.3.5",
here you go @Alex Yang
TypeError: Cannot read properties of undefined (reading 'promise')
have you try to bump the version? both of them?
wdym?
next or ba?
i upgraded to 1.3.9 but still same
@Alex Yang anything?
yeah I mean bump both nextjs and better-auth
what's your config?
can you run
npx @better-auth/cli info --jsonyeah
@Alex Yang here
I might take a look after dinner. But if you can provide a reproduce code and I can debug it quicker
i have no idea
i cant host it on coolify
with nixpack
i can build it vercel and locally
it works fine
feels like it related to the deps.
you need find out which code call
promise
maybe try bump nextjs to latest, or even canaryim sure not because of this
@bekacru can you look at to this?
you can solve it
its important
you're trying to build a page that requires auth as a static page
so what i need to do for fix it?
@Max anything?
basically find a page you're calling
authClient with, that'll end up being served us a static page and force it to be dynamic or move some of the parts to a client component or something similar.i removed my all
authClient and auth.api calls on pages but its still same
im not even using authClient right now
@Max hereoh even on compoenents make sure those components don't get rendered as a static page
im so confused because i can build it locally and build it on vercel
but i cant do it with Nixpack or Dockerfile on coolify
i tried to update Next and BA version but it didnt go well too
So i need to make them all dynamic pages?
page.tsx -> export default async function Test() { return <ClientComponent /> }
or export const dynamic = "force-dynamic";
where you're using authClient yes
since on build time auth client won't be able to make api requets
but right now im not using authClient anywhere
because i deleted them for testing, i created a new branch on git
but still same error
anything ? @Max
i still cant deploy my app
So your not using Better-auth anywhere in your UI, but it won't build in your hosting provider?
im only using auth.api on api routes, not using on client side right now but still cant build it
building with NixPacks
on coolify
"better-auth": "^1.3.6",
"next": "15.3.5",
no idea why it happeing
So you think something in better-auth is causing this?
#13 24.37 TypeError: Cannot read properties of undefined (reading 'promise')
#13 24.40 [Error: Failed to collect page data for /api/auth/[...all]] {
isnt it better auth error?
.
full build logs
Can you show me what you have in route.ts? I assume you just copied from our docs right
yeah im literally just using this
nothing more

all routes works good
no i mean in
app/api/auth/[...all]/route.jsnothing

yeah that looks fine & normal, it doesn't make sense that build would fail and caused by that file
Building on local & vercel works for you too, are you sure you don't have some special configuration or anything on coolify or with nixpacks causing this?
no literally zero config
other next apps works good
( without BA )
it runs npm run build
Can you make a minimal repro?


wdym?
Make a simple version of your app that makes that error in a github repo so that we can run the code ourselves and see if we can solve it
i can give you perms in repo if you want
whats ur email?