❌ Failed to collect page data for api trpc [trpc] ❌
I'm getting this error when I deploy to Vercel
Framework: NEXTJS
Anyone resolved this issue 🤔, HELP PLEASE!!

7 Replies
Did you find a solution to this?
Is your file name correct?
And are there any more logs?
I am having this same issue in a github ci/cd not going to vercel, I am still digging into it and don't feel comfortable sharing my entire log on that
There should be another error further up in the logs. This one doesn't really tell anyone anything
Hi, did you manage to solve this issue?
same problem here
seemingly because of my db url which next js has no business accessing during the build:
```
#17 73.30 TypeError [ERR_INVALID_URL]: Invalid URL
#17 73.30 at new NodeError (node:internal/errors:405:5)
#17 73.30 at new URL (node:internal/url:676:13)
#17 73.30 at /app/.next/server/chunks/313.js:38:992
#17 73.30 at /app/.next/server/chunks/313.js:38:1247
#17 73.30 at ev (/app/.next/server/chunks/313.js:38:3562)
#17 73.30 at 30186 (/app/.next/server/chunks/126.js:1:729)
#17 73.30 at t (/app/.next/server/webpack-runtime.js:1:128)
#17 73.30 at 31765 (/app/.next/server/app/api/trpc/[trpc]/route.js:8:13491)
#17 73.30 at t (/app/.next/server/webpack-runtime.js:1:128)
#17 73.30 at r (/app/.next/server/app/api/trpc/[trpc]/route.js:9:39130) {
#17 73.30 input: 'postgresql://:@db:5432/***',
#17 73.30 code: 'ERR_INVALID_URL'
#17 73.30 }
I'm horribly late, but I just had this issue again and searched for way too long 🙂
As SebasPtsch mentioned above, there needs to be another error above this one.
For me personally the issue was that I had stripe configured like new Stripe(apiKey);
If apiKey was not set (due to env vars not being available during build), the error above was shown. Having a fallback API key or not attempting to create the Stripe client when no apiKey is set, solved this for me.
But again, please check the specific error before the one shown here.