Question about 'Upload value invalid' error.
See original GitHub issueHi! I’m sorry if this is not the best way for adding this, please direct me to a better place if that’s the case. I followed your implementation for adding Upload capabilities to an existing application. The code uses the GraphQLUpload
and FileUpload
classes, and the mutation looks something like this:
@typeGraphql.Mutation(() => Boolean)
async addProfilePicture(
@typeGraphql.Arg("picture", () => GraphQLUpload)
{
createReadStream,
filename
}: FileUpload): Promise<boolean> {
return new Promise(async (resolve, reject) =>
createReadStream()
.pipe(createWriteStream(__dirname + `/../../../images/${filename}`))
.on("finish", () => resolve(true))
.on("error", () => reject(false))
);
}
In Postman I have the following body:
operations:{"query":"mutation addProfilePicture($picture: Upload!) {addProfilePicture(picture: $picture)}", "variables": {"picture": null}}
map:{"0":["variables.picture"]}
and a local file added in the ‘0’ field.
when running a query with Postman, I get the error:
Variable \"$picture\" got invalid value {}; Expected type Upload. Upload value invalid
I’ve been at this for 3 days already. could use a bit of help…
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Variable "$file" got invalid value {}; Upload value invalid
I am using typegraphql and graphql-upload on my backend: @Mutation(() => Boolean) async uploadImage( @Arg('file', () => GraphQLUpload) upload: ...
Read more >400 Bad request when uploading a file via GraphQL
I'm trying to implement a single file upload. ... still get the same error → "“Variable “$file” got invalid value {}; Upload value...
Read more >Failed when trying to upload a file from Graphql
My problem is with the updateFieldsValues mutation. ... "errors": [ { "message": "Invalid input: foto_do_cnpj_cpf ([\"uploads/7c3b7885-16d5- ...
Read more >Focused Build - Error Uploading Test Script : "Invalid value for ...
The error received upon upload is: "Invalid value for step number: 1.10." Steps to reproduce: Download the .txt file attached to this question...
Read more >How can I fix the UTF-8 error when bulk uploading users?
Open the CSV file from Excel and verify the data: Even if you find a problem, do not save the file in Excel....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@flashcrow2000 It took me a while to solve this problem. Give this a try… it worked for me. I’m using Node 15, NestJS Graphql
Hi, it depends on ApolloClient that you used. 1- If used import { ApolloClient } from ‘apollo-client’ must be used “createUploadLink” instead of "createHttpLink "means,
2- if used createApolloClient, exact this package: