<fields> is missing.
Created a simple post request that should create a user with a specific name, but I get an error
app.controllers.ts:
app.service.ts:
I don't even know what can cause it, I'm new to this field, but I read a couple of articles in detail on how to get started. But it didn't work. By the way, this request works properly!
PrismaClientValidationError:
Invalid
this.prisma.user.create()
invocation in
C:\Users\reven\proj\src\app.service.ts:14:29
11 }
12
13 async createUser(name: string) {
→ 14 return this.prisma.user.create({
data: {
+ name: String
}
})
Argument name
is missing.5 Replies
You chose to compile with the bot. One moment while I piece together your answer…
Based on the information provided in your question and the knowledge sources available, it appears that you're encountering an error when trying to create a user using Prisma in a NestJS application. However, the specific error message is not provided in your question, which makes it challenging to pinpoint the exact issue.
That being said, there are a few things we can check based on common issues:
1. Prisma Client Generation:
Make sure you have generated the Prisma client after defining your schema. Run the following command:
2. PrismaService Implementation:
Ensure that your
PrismaService
is correctly implemented. It should extend PrismaClient
and connect to the database. Here's an example of how it should look:
3. Module Configuration:
Make sure that PrismaService
is properly provided in your module (likely AppModule
):
4. Error Handling:
It's a good practice to add error handling to your service methods. This can help you identify the specific error you're encountering. For example:
If you're still encountering issues after checking these points, please provide the specific error message you're receiving. This will help in diagnosing the problem more accurately.
For more information on setting up Prisma with NestJS, you can refer to the Building a REST API with NestJS and Prisma blog post.
Citations:
Building a REST API with NestJS and Prisma
🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly.
In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
But
I do this:
this is working, something problem in postman?
Oh..

And too work