#Blog Tutorial - primsa.post.upsert() error

1 messages · Page 1 of 1 (latest)

rancid yew
#

Hello, I am trying to work through the Blog Tutorial and I am getting this error when first modifying seed.ts:

Property 'post' does not exist on type 'PrismaClient<PrismaClientOptions, never, RejectOnNotFound | RejectPerOperation | undefined>'.

I have tried typing it out myself and coping and pasting from the walkthrough. Everything up until this point has worked.

tidal sun
#

Make sure you ran npx prisma db push before editing seed.

#

Afterwards, you might need to restart your typescript server to get the new types.

#

That's F1 >Typescript: Restart TS Server

rancid yew
#

Thanks for the response. I tried both and I am still getting the same error.

tidal sun
#

Can I take a look at your prisma.schema?

rancid yew
#

Surely. Also, thanks for much for helping me dig into this. I'm 100% to any tool like this and it's very overwhelming.

tidal sun
#

Been a while for me, Let me look up the blog tutorial.

#

You're here?

#

I don't see the model Post { you're supposed to add there.

rancid yew
#

I also see that there is a video course to go along with it. I'll check that as well.

tidal sun
#

Yep, Kent's a great teacher. Just note some minor syntax has changed since then, but the course is largely the same.

rancid yew
#

Yeah, so I added model Post { /content/ } into prsima/schema.prisma

#

Then I ran:
npx prisma db push

#

Then I added the large block of post content as shown in the next step.

rancid yew
#

After that it says to run:
npx prisma db seed.

#

But my prisma/seed.ts has the line:
await prisma.post.upsert({
underlined.

#

specifically it is saying that post is not defined.

tidal sun
#

What happens when you ran npx prisma db push?

#

Did you save after editing schema.prisma?

rancid yew
#

It succeeds.

#

....

#

Oh geez.

tidal sun
#

😄

rancid yew
#

🫣

tidal sun
#

Happens to all of us

#

once

rancid yew
#

I had saved every other file except schema.prisma

#

Thank you so much for helping me to debug.

#

Quick question while you're here.

tidal sun
#

No prob, schema.prisma is a bit weird since it's not a typical js file.

#

You can add the official Prisma extension in VS code to help.

rancid yew
#

I'm very overwhelmed with all of the different languages and tools in this stack. Should I start somewhere else? Should I look at any other resources? Because right now I'm typing things but I don't really know what I'm typing. Every now and then I recognize HTML or Typescript (at least I think it's typescript because it's similar to Javascript)

rancid yew
tidal sun
#

Yeah, Microsoft owns the whole dev toolchain now.

#

praise be

#

Should look into Co-Pilot as well. Comes in really handy to avoid syntax mistakes.

mental jasper
# rancid yew

Same place, but my problem is about compiling errors,

typescript: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher.

any suggests?