Hello.
I'm just trying to create a post using the mutation generate by the "t.crud", and i'm getting this error when trying to set a list of strings in argument:
"Could not find input type name: String"
This is the mutation:
mutation {
createPost(
data: {
title: "hello mundo"
subtitle: "testing"
edition: ""
videoUrl: ""
type: NEWS
description: "this is a test description"
categories: { set: [] }
}
) {
id
categories
title
subtitle
edition
cover
description
videoUrl
}
}
And here's my prisma.schema:
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "rhel-openssl-1.0.x"]
}
enum Type {
MAGAZINE
NEWS
}
/// The post entity
model Post{
///Id of the post
id String @id @default(cuid())
///Post title
title String
///Post description
description String?
///Post subtitle
subtitle String?
///Post edition number
edition String?
///Post cover image
cover String?
///Post videoUrl
videoUrl String?
//Post categories
categories String[]
///Post images
images String[]
///Post files
files String[]
///Type of the post that can be news or magazine
type Type @default(NEWS)
///Attribute that contains the audience of the post
audience String[]
///Attribute that contains the id of the users who liked
likedBy String[]
///Who has deleted the post
deletedBy String?
///When the post was deleted
deletedAt DateTime?
createdBy String?
///When the post was created
createdAt DateTime @default(now())
active Boolean @default(true)
///When the post was last updated
updatedAt DateTime @updatedAt
///Who was the last user that updated the post
updatedBy String?
}
Right now i'm getting this output:
{
"errors": [
{
"message": "Could not find input type name: String",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"createPost"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"stacktrace": [
"Error: Could not find input type name: String",
" at DmmfDocument.getInputTypeWithIndexedFields (/home/mihazs/Dev/backend-cms-service/node_modules/nexus-prisma/src/dmmf/DmmfDocument.ts:53:13)",
" at transformNullsToUndefined (/home/mihazs/Dev/backend-cms-service/node_modules/nexus-prisma/src/null.ts:32:37)",
" at transformNullsToUndefined (/home/mihazs/Dev/backend-cms-service/node_modules/nexus-prisma/src/null.ts:34:26)",
" at Object.transformNullsToUndefined (/home/mihazs/Dev/backend-cms-service/node_modules/nexus-prisma/src/null.ts:34:26)",
" at originalResolve (/home/mihazs/Dev/backend-cms-service/node_modules/nexus-prisma/src/builder.ts:323:24)",
" at resolve (/home/mihazs/Dev/backend-cms-service/node_modules/nexus-prisma/src/builder.ts:349:21)",
" at /home/mihazs/Dev/backend-cms-service/node_modules/@nexus/schema/src/plugins/nullabilityGuardPlugin.ts:103:13",
" at lastResolver (/home/mihazs/Dev/backend-cms-service/node_modules/@nexus/schema/src/plugin.ts:176:14)",
" at /home/mihazs/Dev/backend-cms-service/node_modules/graphql-middleware/src/applicator.ts:34:9",
" at middleware (/home/mihazs/Dev/backend-cms-service/node_modules/graphql-shield/src/generator.ts:70:22)"
]
}
}
}
],
And my implementation uses the createpost generate by the crud feature:
import { mutationField } from "@nexus/schema";
import { IPostCreateResolverFields } from "../index";
export const createPost = mutationField((t) => {
t.crud.createOnePost({
alias: "createPost",
computedInputs: {
createdBy: ({ ctx }: IPostCreateResolverFields) => ctx.user?.userId,
createdAt: () => new Date(Date.now()).toISOString(),
updatedAt: () => new Date(Date.now()).toISOString(),
updatedBy: ({ ctx }: IPostCreateResolverFields) => ctx.user?.userId,
deletedBy: () => null,
deletedAt: () => null,
likedBy: () => ({
set: [],
}),
cover: () => null,
images: () => ({
set: [],
}),
files: () => ({
set: [],
}),
},
});
});
I've tried to remove the computed inputs, and the computed inputs that doesn't have a list, but no success.
I think that can be a bug.
Thanks.
I have the same issue.
Edit: Reverting from v0.15.0 to v0.14.0 fixed it.
I have the same issue.
Edit: Reverting from v0.15.0 to v0.14.0 fixed it.
My work around was implement the method createPost by myself
Hi !
I think this may be related to this issue.
I'm trying to create an entry with a DateTime field in my database using the crud method but I'm having this error:
Could not find input type name: DateTime
I tried by creating the same mutation manually and It works too. Could this be related to the scalar type DateTime recognized as an input type in the buildCrud function? It's somewhere here but I don't understand all the magic behind this so I'm calling for your help 馃槃
Here is my mutation:
schema.mutationType({
definition(t) {
t.crud.createOnePet({
computedInputs: {
owner: ({ ctx }) => ({
connect: {
id: ctx.currentUser.id,
},
}),
},
})
},
})
My pet object:
schema.objectType({
name: 'Pet',
definition(t) {
t.model.id()
t.model.name()
t.model.birthday()
t.model.owner()
},
})
And my GraphQL call

"nexus": "0.25.0",
"nexus-plugin-prisma": "^0.16.1"
Hey folks 馃憢,
This issue should now be solved by #739. If you want to try it out before the stable release, please install nexus-plugin-prisma@next. I'll close the issue now, if the problem is persisting, feel free to re-open it 馃檶
Most helpful comment
Hey folks 馃憢,
This issue should now be solved by #739. If you want to try it out before the stable release, please install
nexus-plugin-prisma@next. I'll close the issue now, if the problem is persisting, feel free to re-open it 馃檶