Next.js Discord

Discord Forum

Build error occurred - Error: Failed to collect page data for

Unanswered
Pacific sand lance posted this in #help-forum
Open in Discord
Pacific sand lanceOP
I’m getting a build error after upgrading from “next”: “13.4.13” to “13.5.1”. The following package seems to be causing me the problem: “@temporalio/client” as my project will build if I remove it from the code. This code is being used in a route handler.

Does anyone know what may be causing this issue or have any suggestions on what I can do to troubleshoot further?

11 Replies

Can you send the code of that Route Handler?
Pacific sand lanceOP
Sure, I made a minimal route to isolate the issue to the package so it’s not doing anything expect trying to use the package giving me issues.
You can see the error it's written
undefined reading("api")
Must be from other file.
It's because your data is not passing (might be cuz its not present) or if its the dynamic route than that particular seems to be empty causing this error.
Send the file where you using anything related to api or you might think of anything that could be related to it.
Pacific sand lanceOP
I’m confused why I’m seeing this behavior: If I comment out the client and connect code (lines 1 and 5) it builds successfully. When I add it back in, it fails with the same error.
Ohh yea, it might be cuz you can't use client related interactions in server components like Route Handlers.
Pacific sand lanceOP
I think it’s an webclient and not a client react component. Also, this same code builds if I downgrade to next 13.4.13. So, something in the upgrade seems to be handling it differently.
Yea could be.