jaydenseric / graphql-upload

Middleware and a scalar Upload to add support for GraphQL multipart requests (file uploads via queries and mutations) to various Node.js GraphQL servers.
https://npm.im/graphql-upload
MIT License
1.43k stars 132 forks source link

Upload File not working ! #277

Closed kamalkech closed 2 years ago

kamalkech commented 2 years ago

@Mutation(() => Boolean) async uploadFile( @Args({ name: 'file', type: () => GraphQLUpload }) file: FileUpload, ) { .... return true; }


- in postman or insomnia
```typescript
- operation = { "query": "mutation ($file: Upload!) { uploadFile(file: $file) }", "variables": { "file": null } }
- map         = { "0": ["variables.file"] }
- 0              = file.jpeg

i get error message:

{
  "errors": [
    {
      "message": "Unknown type \"Upload\". Did you mean \"Float\"?",
      ....
    }
  ]
}
SamuelNoB commented 2 years ago

two questions. Have you already written scalar Upload in any of your schemas? And did you defined the Upload in your resolvers like that {resolvers: {Upload: GraphQLUpload}?

jaydenseric commented 2 years ago

@kamalkech hopefully you've solved the problem by now; feel free to share what was wrong for others that come across this issue.

Closing because this issue doesn't really fit into the category of an actionable graphql-upload bug report or feature request.