Hello, I just started using redwood I am trying to go over the tutorial on Redwood, and currently I can’t get past Chapter 7:section2(Accessing currentUser in the API), I am trying to run the “$ yarn rw prisma db seed” command, but I am getting this error:
$ yarn rw prisma db seed
Running Prisma CLI...
$ yarn prisma db seed
Running seed command `yarn rw exec seed` ...
[STARTED] Generating Prisma client
[COMPLETED] Generating Prisma client
[STARTED] Running script
{"level":50,"time":1695358310601,"pid":43892,"hostname":"DESKTOP-61E0LCR","prisma":{"clientVersion":"5.3.1"},"timestamp":"2023-09-22T04:51:50.601Z","message":"\nInvalid `db.post.upsert()` invocation in\nD:\\GitHub\\guilherme-vilatoro-taglianeti-cs490-hw3\\scripts\\/seed.js:40:19\n\n 37 })\n 38 \n 39 for (const post of POSTS) {\n→ 40 await db.post.upsert({\n where: {\n id: 1\n },\n create: {\n id: 1,\n ~~\n title: \"Welcome to the blog!\",\n body: \"I'm baby single- origin coffee kickstarter lo - fi paleo skateboard.Tumblr hashtag austin
whatever DIY plaid knausgaard fanny pack messenger bag blog next level woke.Ethical bitters fixie freegan,helvetica pitchfork 90's tbh chillwave mustache godard subway tile ramps art party. Hammock sustainable twee yr bushwick disrupt unicorn, before they sold out direct trade chicharrones etsy polaroid hoodie. Gentrify offal hoodie fingerstache.\",\n userId: 1,\n ? createdAt?: DateTime,\n
? comments?: CommentCreateNestedManyWithoutPostInput\n },\n update: {}\n })\n\nUnknown argument `id`. Did you mean `body`? Available options are listed in green.","target":"post.upsert","msg":"\nInvalid `db.post.upsert()` invocation in\nD:\\GitHub\\guilherme-vilatoro-taglianeti-cs490-hw3\\scripts\\/seed.js:40:19\n\n 37 })\n 38 \n 39 for (const post of POSTS) {\n→ 40 await db.post.upsert({\n where: {\n id: 1\n },\n create: {\n id: 1,\n ~~\n title: \"Welcome to the blog!\",\n body: \"I'm baby single- origin coffee
kickstarter lo - fi paleo skateboard.Tumblr hashtag austin whatever DIY plaid knausgaard fanny pack messenger bag blog next level woke.Ethical bitters fixie freegan,helvetica pitchfork 90's tbh chillwave mustache godard subway tile ramps art party. Hammock sustainable twee yr bushwick disrupt unicorn, before they sold out direct trade chicharrones etsy polaroid hoodie. Gentrify offal hoodie fingerstache.\",\n
userId: 1,\n ? createdAt?: DateTime,\n ? comments?: CommentCreateNestedManyWithoutPostInput\n },\n update: {}\n })\n\nUnknown argument `id`. Did you mean `body`? Available options are listed in green."}
Error in script:
Invalid `db.post.upsert()` invocation in
D:\GitHub\guilherme-vilatoro-taglianeti-cs490-hw3\scripts\/seed.js:40:19
37 })
38
39 for (const post of POSTS) {
→ 40 await db.post.upsert({
where: {
id: 1
},
create: {
id: 1,
~~
title: "Welcome to the blog!",
body: "I'm baby single- origin coffee kickstarter lo - fi paleo skateboard.Tumblr hashtag austin whatever DIY plaid knausgaard fanny pack messenger bag blog next level woke.Ethical bitters fixie freegan,helvetica pitchfork 90's tbh chillwave mustache godard subway tile ramps art party. Hammock sustainable twee yr bushwick disrupt unicorn, before they sold out direct trade chicharrones etsy polaroid hoodie. Gentrify offal hoodie fingerstache.",
userId: 1,
? createdAt?: DateTime,
? comments?: CommentCreateNestedManyWithoutPostInput
},
update: {}
})
Unknown argument `id`. Did you mean `body`? Available options are listed in green.
[FAILED]
Invalid `db.post.upsert()` invocation in
D:\GitHub\guilherme-vilatoro-taglianeti-cs490-hw3\scripts\/seed.js:40:19
37 })
38
39 for (const post of POSTS) {
→ 40 await db.post.upsert({
where: {
id: 1
},
create: {
id: 1,
~~
title: "Welcome to the blog!",
body: "I'm baby single- origin coffee kickstarter lo - fi paleo skateboard.Tumblr hashtag austin whatever DIY plaid knausgaard fanny pack messenger bag blog next level woke.Ethical bitters fixie freegan,helvetica pitchfork 90's tbh chillwave mustache godard subway tile ramps art party. Hammock sustainable twee yr bushwick disrupt unicorn, before they sold out direct trade chicharrones etsy polaroid hoodie. Gentrify offal hoodie fingerstache.",
userId: 1,
? createdAt?: DateTime,
? comments?: CommentCreateNestedManyWithoutPostInput
},
update: {}
})
Unknown argument `id`. Did you mean `body`? Available options are listed in green.
┌ Error ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│ ││ PrismaClientValidationError: ││ Invalid `db.post.upsert()` invocation in ││ D:\GitHub\guilherme-vilatoro-taglianeti-cs490-hw3\scripts\/seed.js:40:19 ││ ││ 37 }) ││ 38 ││ 39 for (const post of POSTS) { ││ → 40 await db.post.upsert({ ││ where: { ││ id: 1 ││ }, ││ create: { ││ id: 1, ││ ~~ ││ title: "Welcome to the blog!", ││ body: "I'm baby single- origin coffee kickstarter lo - fi paleo skateboard.Tumblr hashtag austin whatever DIY plaid knausgaard fanny pack messenger bag blog next level woke.Ethical bitters fixie ││ freegan,helvetica pitchfork 90's tbh chillwave mustache godard subway tile ramps art party. Hammock sustainable twee yr bushwick disrupt unicorn, before they sold out direct trade chicharrones etsy ││ polaroid hoodie. Gentrify offal hoodie fingerstache.", ││ userId: 1, ││ ? createdAt?: DateTime, ││ ? comments?: CommentCreateNestedManyWithoutPostInput ││ }, ││ update: {} ││ }) ││ ││ Unknown argument `id`. Did you mean `body`? Available options are listed in green. ││ at yn (D:\GitHub\guilherme-vilatoro-taglianeti-cs490-hw3\node_modules\@prisma\client\runtime\library.js:116:5852) ││ at wn.handleRequestError (D:\GitHub\guilherme-vilatoro-taglianeti-cs490-hw3\node_modules\@prisma\client\runtime\library.js:123:6429) ││ at wn.handleAndLogRequestError (D:\GitHub\guilherme-vilatoro-taglianeti-cs490-hw3\node_modules\@prisma\client\runtime\library.js:123:6119) ││ at wn.request (D:\GitHub\guilherme-vilatoro-taglianeti-cs490-hw3\node_modules\@prisma\client\runtime\library.js:123:5839) ││ at l (D:\GitHub\guilherme-vilatoro-taglianeti-cs490-hw3\node_modules\@prisma\client\runtime\library.js:128:9763) ││ at Object._default [as default] (D:\GitHub\guilherme-vilatoro-taglianeti-cs490-hw3\scripts\/seed.js:40:5) ││ at runScriptFunction (D:\GitHub\guilherme-vilatoro-taglianeti-cs490-hw3\node_modules\@redwoodjs\cli\dist\lib\exec.js:19:23) ││ at _Task.task [as taskFn] (D:\GitHub\guilherme-vilatoro-taglianeti-cs490-hw3\node_modules\@redwoodjs\cli\dist\commands\execHandler.js:103:9) ││ at _Task.run (D:\GitHub\guilherme-vilatoro-taglianeti-cs490-hw3\node_modules\listr2\dist\index.cjs:2049:11) ││ ││ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ││ ││ Need help? ││ - Not sure about something or need advice? Reach out on our Forum (https://community.redwoodjs.com/) │
│ - Think you've found a bug? Open an issue on our GitHub (https://github.com/redwoodjs/redwood) │
│ - Here's your unique error reference to quote: 'e9557184-8f88-4c4f-8389-dd22067c28e4' ││ │└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
An error occurred while running the seed command:
Error: Command failed with exit code 1: yarn rw exec seed
I did make the changes on the seed.js file, but I don’t know if it is correct(my version):
import { db } from 'api/src/lib/db'
const POSTS = [
{
id: 1,
title: 'Welcome to the blog!',
body: "I'm baby single- origin coffee kickstarter lo - fi paleo skateboard.Tumblr hashtag austin whatever DIY plaid knausgaard fanny pack messenger bag blog next level woke.Ethical bitters fixie freegan,helvetica pitchfork 90's tbh chillwave mustache godard subway tile ramps art party. Hammock sustainable twee yr bushwick disrupt unicorn, before they sold out direct trade chicharrones etsy polaroid hoodie. Gentrify offal hoodie fingerstache.",
userId: 1,
},
{
id: 2,
title: 'A little more about me',
body: "Raclette shoreditch before they sold out lyft. Ethical bicycle rights meh prism twee. Tote bag ennui vice, slow-carb taiyaki crucifix whatever you probably haven't heard of them jianbing raw denim DIY hot chicken. Chillwave blog succulents freegan synth af ramps poutine wayfarers yr seitan roof party squid. Jianbing flexitarian gentrify hexagon portland single-origin coffee raclette gluten-free. Coloring book cloud bread street art kitsch lumbersexual af distillery ethical ugh thundercats roof party poke chillwave. 90's palo santo green juice subway tile, prism viral butcher selvage etsy pitchfork sriracha tumeric bushwick.",
userId: 1,
},
{
id: 3,
title: 'What is the meaning of life?',
body: 'Meh waistcoat succulents umami asymmetrical, hoodie post-ironic paleo chillwave tote bag. Trust fund kitsch waistcoat vape, cray offal gochujang food truck cloud bread enamel pin forage. Roof party chambray ugh occupy fam stumptown. Dreamcatcher tousled snackwave, typewriter lyft unicorn pabst portland blue bottle locavore squid PBR&B tattooed.',
userId: 1,
},
]
export default async () => {
// create an admin user
await db.user.upsert({
where: { id: 1 },
create: {
id: 1,
name: 'John Doe',
email: 'admin@admin.com',
hashedPassword:
'ad9563042fe9f154419361eeeb775d8a12f3975a3722953fd8e326dd108d5645',
salt: '1c99de412b219e9abf4665293211adce',
},
update: {},
})
for (const post of POSTS) {
await db.post.upsert({
where: { id: post.id },
create: { ...post },
update: {},
})
console.log(` Seeded "${post.title}"`)
}
console.info('')
console.info(' Seeded admin user:')
console.info('')
console.info(' Email: admin@admin.com')
console.info(' Password: admin')
console.info('')
console.info(` (Please don't use this login in a production environment)`)
console.info('')
}
It is important to mention that I am using the repository given at the intermission, and am open for suggestions.