In GraphQL builder 1.x we could use the Upload type as argument from a mutation, but in 2.x this error message is displayed in the vtex link and the application does not run:
20:45:48.387 - error: App build failed with message: Type "Upload" not found in document.
I circumvented the problem by creating a scalar GraphqlUpload and using it. But I still had problems implementing my mutation that uses file upload because the type signature for the file argument (now GraphqlUpload) changed to something like (obtained from a console.log):
Upload {
resolve: [Function (anonymous)],
reject: [Function (anonymous)],
promise: Promise {
{
filename: 'cart.csv',
mimetype: 'text/csv',
encoding: '7bit',
createReadStream: [Function: createReadStream]
}
},
file: {
filename: 'cart.csv',
mimetype: 'text/csv',
encoding: '7bit',
createReadStream: [Function: createReadStream]
}
}
So I changed my implementation from:
const { createReadStream } = await fileArg
to:
const { createReadStream } = fileArg.file
And everything started working as before. However, I found it a little strange that I couldn’t use the Upload type directly anymore, and I believe it was a mistake.