Hi,
I wanted to test RedwoodJS by doing the tutorials. Everything worked fine until I reached the Cells section. I followed and didn’t customize anything.
Right after creating my first cell and integrateding it into HomePage.js I don’t have the same output as mentioned in the screenshot. I get an error in the terminal:
Invalid `db.post.findMany()` invocation in
api | /Users/me/Documents/dev/git/redwoodblog/api/src/services/posts/posts.js:4:18
api |
api | 1 import { db } from 'src/lib/db'
api | 2
api | 3 export const posts = () => {
api | → 4 return db.post.findMany(
api | Failed to validate the query: `Field does not exist on enclosing type.` at `Query.findManyPost`
Hi Giregar! Sorry about this…could you try stopping and re-starting the dev server? If that doesn’t help, try stopping the server, then running:
yarn rw prisma generate
And then starting the dev server again. We normally do this behind the scenes automatically, but this seems like the kind of error that would happen if that had NOT run like it should. Let me know if it works!
Thank you for the fast response rob. The error changed to
api | Invalid `db.post.findMany()` invocation in
api | /Users/me/Documents/dev/git/redwoodblog/api/src/services/posts/posts.js:4:18
api |
api | 1 import { db } from 'src/lib/db'
api | 2
api | 3 export const posts = () => {
api | → 4 return db.post.findMany(
api | The table `main.Post` does not exist in the current database.
Yes I did run the migration and can see the table in Prisma Studio. The output after running yarn rw prisma migrate dev is
Environment variables loaded from .env
Prisma schema loaded from api/db/schema.prisma
Datasource "db": SQLite database "dev.db" at "file:./dev.db"
Already in sync, no schema change or pending migration was found.
I don’t know what I could have done differently than in the tutorial, but I assume that I followed the steps 1:1. So I will just delete the project again and start the whole tutorial from scratch. Thank you for your help!
When I try to save a new post, I get the following error:
api | Invalid `db.post.create()` invocation in
api | /Users/me/Documents/git/redwoodblog/api/src/services/posts/posts.js:14:18
api |
api | 11 }
api | 12
api | 13 export const createPost = ({ input }) => {
api | → 14 return db.post.create(
api | Failed to validate the query: `Field does not exist on enclosing type.` at `Mutation.createOnePost`
At that step, I didn’t touch any of the auto-generated files.
Please excuse me, I’m curious, I’m also running Node v16 (v16.11.1 to be precise) I went all the way through Tutorial 1 without this error so I don’t think it is Node that is your problem. I’m also too new to Redwood to be of more help though.
@mattsears18 I know this sucks, but you could try deleting node_modules and then running yarn install again. It’s the nuclear option, but the last time this came up it looked like Prisma had two copies of its generated client libraries lying around and this was the surefire way to fix it.
@dthyresson did we ever learn anything more about this issue?
@rob thanks. I thought I tried that but I’ll give it another shot. The issue popped up after I created a .env, so that might be related… I’ll see if I can reproduce.