System Information
- Strapi Version: v3.6.7
- Operating System:
- Database:
- Node Version: v14.17.5
- NPM Version:
- Yarn Version:
Hello !
I’m trying to submit some fields and an image. Permissions has been set to public for this content type.
Here is my function to upload (using GitHub - prisma-labs/graphql-request: Minimal GraphQL client supporting Node and browsers for scripts)
async function submitFanContent({ author, link, image }: SubmitFanContentArgs) {
const CREATE_FAN_CONTENT = gql`
mutation submitFanContent($author: String!, $link: String!, $image: Upload!) {
createFanContent(input: { data: {
author: $author,
link: $link,
image: $image
}}) {
fanContent {
author
link
image {
url
}
}
}
}
`
return client.request(CREATE_FAN_CONTENT, {
author,
link,
image
})
}
Here is the call of the function :
const data = await submitFanContent({
author: form.author, // string
link: form.link, // string
image: form.image, // This is equal to event.target.files[0]
});
I am getting this error :
{
"errors": [
{
"message": "Variable \"$image\" of type \"Upload!\" used in position expecting type \"ID\".",
"locations": [
{
"line": 2,
"column": 65
},
{
"line": 6,
"column": 16
}
],
"extensions": {
"code": "GRAPHQL_VALIDATION_FAILED"
}
}
]
}
Any help appreciated, thank you!