Tus Error: Value cannot be null. ↵Parameter name: encodedValue;

Hi All,

I’m trying to use for the first time uppy with tus in backend.
I developed a custom uppy UI that call the upload method and i’m getting the error message in the topic in response to my call.
I’ve checked for that parameter on the POST action and i got it in the Upload-Metadata filled with the file name that i’m trying to upload.
So even if the parameter is filled i got that error in response.
What’s the next step to fix it?
Thanks to all.

Hi there,

can you provide more details, in particular following points:

  • Where does that error occur? Can we have a stack trace?
  • What tus server are you using? What’s its configuration?
  • What is the code you are using on the client for uploading?

I still don’t understand what you are trying to do, so I am having a hard time understanding your question.

Hi @marius here below my replies:

The error occurs when i click the upload button in order to upload for example a simple image file.
The code for the upload on the client side is the simple code snippet showed from uppy doc examples.
With the upload function i’m producing a POST call with all the file data set, with the error code in reply:

Message: "Value cannot be null.
↵Parameter name: encodedValue; at tusdotnet.Models.Metadata…ctor(String encodedValue)
↵ at tusdotnet.Models.Metadata.Parse(String uploadMetadata)
↵ at tusdotnet.IntentHandlers.CreateFileHandler.Invoke()
↵ at tusdotnet.TusProtocolHandlerIntentBased.Invoke(ContextAdapter context)
↵ at tusdotnet.TusCoreMiddleware.Invoke(HttpContext context)
↵ at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
↵ at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.InvokeCore(HttpContext context)
↵ at Ts.Selene.ApiServer.Errors.ExceptionMiddleware.InvokeAsync(HttpContext httpContext) in D:\Main Repo\Adam\src\App\Selene\Ts.Selene.ApiServer\Errors\ExceptionMiddleware.cs:line 31"
Severity: “Error”
StatusCode: 500

I’m using tusdotnet server:

Here you can see my config:

“TusConfiguration”: {
“AccessPointType”: “myaccesspointconfig”,
“PathRequest”: “/files”,
“PathStore”: “C:\myapp\tusfiles\”
}
}

This is the code i’m using for the upload:

this.uppy.use(Tus, {
endpoint: “myendopointpath”,
headers: {
authorization: “mytokenforauth”,
},
metaFields:null
})

Please let me know if i missunderstood somethings.
Waiting for you reply.
Thanks :wink:

I’ve fixed the issue.
The problem was a metadata passed with a null value in my Upload-Metadata list in the Header.

Thanks

I am glad to read that you found a solution and I was just about to say that this line looked a bit suspicious:

@marius no, that line was not the problem.
That code line means that uppy will send all the metadata available to the backend.

The problem was a single metadata key with a null value.
But the error don’t specify the metadata key name, so the troubleshoot was a little bit messy.

1 Like