Error testing API route with vitest and server-only - App Router
Unanswered
Forest bachac posted this in #help-forum
Forest bachacOP
I'm trying to import an API route to test it, but I use 'server-only' at the top of the file and it throws the error "Error: This module cannot be imported from a Client Component module. It should only be used from a Server Component"
Apparently this was supposed to fix this in September, but I'm using Next.js 14.0.4 and it is not fixed.
https://github.com/vercel/next.js/pull/54891
import { POST } from "@/app/api/account/email/route.ts";Apparently this was supposed to fix this in September, but I'm using Next.js 14.0.4 and it is not fixed.
https://github.com/vercel/next.js/pull/54891