GraphQLBundle icon indicating copy to clipboard operation
GraphQLBundle copied to clipboard

Upload file variable not provided

Open adlarge opened this issue 3 years ago • 1 comments

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Version/Branch 0.13.6

Hello, i want to upload a file but i always get the error Variable $file of required type UploadedFile! was not provided., whereas the variable is available in Symfony profiler Uploaded Files section.

This what i did, define the UploadedFile type :

UploadedFile:
    type: custom-scalar
    config:
        scalarType: '@=newObject("Overblog\\GraphQLBundle\\Upload\\Type\\GraphQLUploadType")'

Then define a new mutation :

UploadCepc:
  type: "FinalExam"
  resolve: '@=mutation("App\\Infrastructure\\GraphQL\\Mutation\\UploadCepcMutation", [args])'
  args:
      uuid:
          type: "String!"
      file:
          type: "UploadedFile!"

This is what i have in the Symfony profiler : image

Do i miss something ?

adlarge avatar Jan 12 '22 16:01 adlarge

Hi, I think i have the same problem, tested on 0.15.2 and 1.0.0. If a use a mutation with an UploadedFile arg only, it works. But when I use a mutation mixing UploadedFile and other args, the file is not available.

I'm currently trying to debug this. The file appears correctly in the POST Parameters in the profiler (map + uploaded file). Then the file is properly resolved inside Request\Executor and available in variableValues in Executor\Executor but got error when the mutation is executed. I wonder if the problem is not inside webonyx/graphql-php code.

Still digging.

maximecolin avatar Jul 19 '23 14:07 maximecolin