#Issue with Next.js path

8 messages · Page 1 of 1 (latest)

frozen crater
tired sandal
#

Hey @frozen crater, you need to run npx convex dev successfully to get the _generated folder generated.
Then the import path is relative, note that the quickstart has two dots at the start:
import { api } from "../convex/_generated/api";
but your code only has a single dot:
import { api } from "./_generated/api.js";

In the standard setup the convex folder is a sibling to your Next.js app folder.

frozen crater
frozen crater
frozen crater
glass trench
#

It looks like it should be ../../convex since it's in src/app/page.tsx. .. goes to src, ../../ goes to the project root, then ../../convex/ goes to the convex folder

#

inside of the convex folder you should have a _generated folder with api.js in there.

frozen crater
#

Sorry to keep being a bother. I fixed my nesting issue but for a few days now I cannot get "const tasks = useQuery(api.tasks.get);" to work.

I keep getting this error: const tasks = useQuery(api.tasks.get);