Can't build the project
Answered
West Siberian Laika posted this in #help-forum
West Siberian LaikaOP
I have been trying to build this nextjs 14 project but it keeps giving me this error:
I remember making some changes to the route
Error: Invariant: cookies() expects to have requestAsyncStorage, none available.
at u (/vercel/path0/.next/server/chunks/285.js:24:21300)
at a (/vercel/path0/.next/server/chunks/535.js:1:12982)
at 95195 (/vercel/path0/.next/server/app/profile/page.js:1:3224)
at Function.t (/vercel/path0/.next/server/webpack-runtime.js:1:127)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async collectGenerateParams (/vercel/path0/node_modules/next/dist/build/utils.js:919:21)
at async /vercel/path0/node_modules/next/dist/build/utils.js:1138:17
at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:151:20)
> Build error occurred
Error: Failed to collect page data for /profile
at /vercel/path0/node_modules/next/dist/build/utils.js:1258:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
type: 'Error'
}
Error: Command "npm run build" exited with 1I remember making some changes to the route
/profile so I reversed the changes but I kept getting the same error but now I have no idea where it comes from :(Answered by West Siberian Laika
In development mode I hade two functions and thought they could both share the same client so I moved the client right below the imports
14 Replies
Netherland Dwarf
Usually it helps to try googling first
next
They basically made a route.ts file
And moved the cookies access inside the function
Rather than outside
@Netherland Dwarf They basically made a route.ts file
West Siberian LaikaOP
I removed this route.ts file from
/auth/signout, could this be related?I'm just gonna remove the whole route and see what happens
West Siberian LaikaOP
Omg
the mistake I made was very hard to notice
West Siberian LaikaOP
In development mode I hade two functions and thought they could both share the same client so I moved the client right below the imports
Answer
West Siberian LaikaOP
Now I can make orders :3
Though I do have to make some tests to make sure nothing goes wrong
I can never trust my clients