Uppy / Tus is reporting the same error twice

Started by amanagr7 replies141 views
amanagrOriginal post
#1

I am using a TUS backend.

When trying to capture the error using uppy.on("upload-error"). upload-error is emitted twice for the same error, while we expect uppy to only report the error once.

Once here - link to uppy code:

uploadOptions.onError = (err) => {
        this.uppy.log(err)

        const xhr =
          (err as tus.DetailedError).originalRequest != null ?
            (err as tus.DetailedError).originalRequest.getUnderlyingObject()
          : null
        if (isNetworkError(xhr)) {
          // eslint-disable-next-line no-param-reassign
          err = new NetworkError(err, xhr)
        }

        this.resetUploaderReferences(file.id)
        queuedRequest?.abort()

        this.uppy.emit('upload-error', file, err)
        if (typeof opts.onError === 'function') {
          opts.onError(err)
        }
        reject(err)
      }

and once here - link to uppy code:

    }).catch((err) => {
      this.uppy.emit('upload-error', file, err)
      throw err
    })
amanagr
#2

Here is the link to relevent code on Zulip open source project.

amanagr
#3

First error traceback

amanagr
#4

Same error but the logged second time:

amanagr
#5

Here is a reproducer - Uppy Dashboard (forked) - StackBlitz

You can notice the double logged errors after the retry attempts are finished.

Should I open a bug report for this?

#7

Opened issue #5473 on GitHub. Can’t link it here.