No Query Document Supplied Error with File Upload in Phoenix/Absinthe + React/Urql
I’m encountering a “No query document supplied” error when implementing file uploads using Phoenix/Absinthe with React/Urql. The error occurs when attempting to upload an image using the built-in multipart upload functionality in @urql/core@4
.
Setup
Backend (Phoenix/Absinthe):
plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json, Absinthe.Plug.Parser],
pass: ["*/*"],
json_decoder: Jason
# Schema Definition
field :upload_file, :string do
arg(:users, non_null(:upload))
arg(:metadata, :upload)
resolve(fn args, _ ->
# this is a `%Plug.Upload{}` struct
args.users
{:ok, "success"}
end)
end
Frontend (React/Urql):
Error Response
{
"errors": [
{
"message": "No query document supplied"
}
]
}
Environment
- Phoenix + Absinthe (Backend)
- React + Urql (Frontend)
- Using
@urql/core@4
with built-in multipart upload support
I’ve verified that:
- The multipart parser is properly configured in Phoenix
- The schema definition matches the urql example
- The frontend implementation follows the official urql example
Any guidance on resolving this error would be appreciated.