I can’t get /posts to render the table. I don’t see how to correct this.
I’ve been just following along w/the video Tutorial for part 2
Overview
I am able to get to the point were I modify the schema and run the commands but they seem to work differently now.
I tried a few things but I’m not sure what I’m missing.
Here’s the repo after generating the db and running the scaffold command: Here it is, https://github.com/jacebenson/redwoodblog
Differences;
Commands work differently
-
yarn rw db save
- This asks questions in the tutorial but not for me and the output of files is slightly different (more below) -
yarn rw db up
- This seems to not tie up the console in the tutorial but does for me.
More Details;
So @ 1:53 - RedwoodJS Tutorial, Part 2 - YouTube the schema is set up
Here’ my schema;
datasource DS {
// optionally set multiple providers
// example: provider = ["sqlite", "postgresql"]
provider = "sqlite"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "rhel-openssl-1.0.x"]
}
// Define your own datamodels here and run `yarn redwood db save` to create
// migrations for them.
// TODO: Please remove the following example:
model Post {
id Int @id @default(autoincrement())
title String
body String
createdAt DateTime @default(now())
}
Then the command yarn rw db save
is run which seems to ask these questions;
- database Options yes/no.
- name of migration
I don’t see either of these questions.
So I look at the file path and locally its;
/api/prisma/migrations/{{datetimestamp}}-migration
where on the video it shows
/api/prisma/migrations/{{datetimestamp}}-create-posts
I think, okay its different but the output stuff is similar. Lets just see if it works.
Next command yarn rw db up
This also seems to work differently in that on the video its run and done, returns the console to Rob. On mine my console never returns to me. It’s just running the whole time.
Here’s the output of the console
jaceb@home MINGW64 ~/git/redwoodblog
$ yarn rw db up
yarn run v1.22.5
$ C:\Users\jaceb\git\redwoodblog\node_modules\.bin\rw db up
Migrate database up... [started]
$ C:\Users\jaceb\git\redwoodblog\node_modules\.bin\prisma migrate up --experimental --create-db
Prisma Schema loaded from prisma\schema.prisma
migrate up
All migrations are already applied
Migrate database up... [completed]
Generating the Prisma client... [started]
$ C:\Users\jaceb\git\redwoodblog\node_modules\.bin\prisma generate
Prisma Schema loaded from prisma\schema.prisma
Okay, fine maybe it needs to run. New terminal.
So this is all fine still, cause the issue is I want to see the output from the scaffold command.
And it looks like redwood creates the right stuff, but when I navigate to localhost:8910/posts i get an error that something is wrong.
The yarn rw dev shows this output
$ yarn rw dev
yarn run v1.22.5
$ C:\Users\jaceb\git\redwoodblog\node_modules\.bin\rw dev
$ C:\Users\jaceb\git\redwoodblog\node_modules\.bin\webpack-dev-server --config ../node_modules/@redwoodjs/core/config/webpack.development.js
$ C:\Users\jaceb\git\redwoodblog\node_modules\.bin\dev-server
api | Running at 'http://localhost:8911'
api | Watching files in 'C:\Users\jaceb\git\redwoodblog\api\src\functions'
web | i 「wds」: Project is running at http://localhost:8910/
web | i 「wds」: webpack output is served from /
web | i 「wds」: Content not from webpack is served from C:\Users\jaceb\git\redwoodblog\web
web | i 「wds」: 404s will fallback to /index.html
api | Done. Took 2306ms.
api | POST /graphql 200 159.526 ms - 1009
api | POST /graphql 200 27.357 ms - 1009
api |
api | Error:
api | Invalid `prisma.post.findMany()` invocation in
api | C:\Users\jaceb\git\redwoodblog\api\src\services\posts\/posts.js:4:18
api |
api |
api | Failed to validate the query: `Field does not exist on enclosing type.` at `Query.findManyPost`
api |
api |
api | 1 $w.request
api | C:\Users\jaceb\git\redwoodblog\node_modules\@prisma\client\runtime\src\runtime\getPrismaClient.ts:1258
api |
api |
api | Error:
api | Invalid `prisma.post.findMany()` invocation in
api | C:\Users\jaceb\git\redwoodblog\api\src\services\posts\/posts.js:4:18
api |
api |
api | Failed to validate the query: `Field does not exist on enclosing type.` at `Query.findManyPost`
api |
api |
api | 1 $w.request
api | C:\Users\jaceb\git\redwoodblog\node_modules\@prisma\client\runtime\src\runtime\getPrismaClient.ts:1258
api |
I looked around on here and found some post that said to check if yarn rw db studio
works and it seems to I can see the table columns and such.
I would love any feedback.
Oh other posts said to make a repo for it so yall could see the code.