TUS upload api Fails

Hi fellow programmers,

We are using Angular framework as frontend and Nodejs as Backend to implement Direct Creator Upload method. Tried generating one-time upload url and passed it from upload method in angular like below.

onUpload(e) {
    console.log("on upload", e)
    // Get the selected file from the input element
    var file = e.target.files[0]

    // Create a new tus upload
    var upload = new tus.Upload(file, {
      // Endpoint is the upload creation URL from your tus server
      endpoint: "http://localhost:1337/cloudflare/upload",
      // Retry delays will enable tus-js-client to automatically retry on errors
      retryDelays: [0, 3000, 5000],
      // Attach additional meta data about the file for the server
      metadata: {
        filename: file.name,
        filetype: file.type
      // Callback for errors which cannot be fixed using retries
      onError: function (error) {
        console.log("Failed because: " + error)
      // Callback for reporting upload progress
      onProgress: function (bytesUploaded, bytesTotal) {
        var percentage = (bytesUploaded / bytesTotal * 100).toFixed(2)
        console.log(bytesUploaded, bytesTotal, percentage + "%")
      // Callback for once the upload is completed
      onSuccess: function () {
        // console.log("Download %s from %s", upload.file.name, upload.url)

    // Check if there are any previous uploads to continue.
    upload.findPreviousUploads().then(function (previousUploads) {
      // Found previous uploads so we select the first one. 
      if (previousUploads.length) {

      // Start the upload

The url given above in the endpoint key, provides our server api url returning the one-time tokenized url in “location” key as suggested by many people in the community for those who faced similar issues. However, it still did not work and we were getting the error below.

Failed because: Error: tus: failed to create upload, caused by [object ProgressEvent], originated from request (method: POST, url: http://localhost:1337/cloudflare/upload, response code: n/a, response text: n/a, request id: n/a)

Please guide us on how to proceed. The code that we wrote in nodejs is as below.

I am afraid this forum is not developer oriented and not for development questions.

You best clarify this on tus.io.

1 Like

I think it still makes sense to ask that question here because this is related to Cloudflare Stream Direct Creator Upload - it could be Stream API issue.


Hey Sandro,

I kind of saw similar questions here and they replied that we should not pass the one time tokenized url directly in tus.upload in frontend but to call the server link which returns the one time url in the location key. I saw few got resolved it in private conversation, but the solution was not shared. I suspect the way we return the response. A little guidance of what the response should be will help a lot.

I think @zaid is the more suitable person to answer this question.

This does not really appear to be about a Cloudflare issue but rather on how to use the library respectively what values to pass.

Then it would be great if the OP posts his question on tus.io forum too.

He was the one who guided the questions similar to it before too

Hi Sandro,

The normal tus upload with authentication passed in the parameters works fine. It’s the one time url that fails. Okay, I will post this in the website you are suggesting.

This forum is for users of Cloudflare Stream, most of whom are developers. Development questions are certainly welcome here and will get a response from the team.

This is a key source of where we discover misunderstandings and shortcomings of the Stream APIs. Publicly helping out developers in this forum makes future visitors to this forum get answers to the same questions with much more ease.

1 Like

This must have been a change in policy then and certainly changes things.

Currently working to see if there is a bug and try to point @manjula.m the right direction. It’s worth to point out that @cheng has also faced a similar issue at Error in direct creator's tokenlized url using tus

I can confirm that this service is not having any disruptions in the backend. I suggest you check out the links posted at Error in direct creator's tokenlized url using tus for additional guidance.

Thank you very much. Much helpful.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.