shallwefootball / upload-s3-action

github action for upload to S3 ☁️
https://github.com/marketplace/actions/upload-s3
166 stars 158 forks source link

Bogus error handling #9

Open kittaakos opened 4 years ago

kittaakos commented 4 years ago

I had this error with @1.0.1:

Run shallwefootball/s3-upload-action@v1.0.1
/home/runner/work/_actions/shallwefootball/s3-upload-action/v1.0.1/dist/index.js:8307
            throw err;
            ^

Error [TypeError]: (s || "").replace is not a function
    at escapeData (/home/runner/work/_actions/shallwefootball/s3-upload-action/v1.0.1/dist/index.js:8121:10)
    at Command.toString (/home/runner/work/_actions/shallwefootball/s3-upload-action/v1.0.1/dist/index.js:8115:35)
    at issueCommand (/home/runner/work/_actions/shallwefootball/s3-upload-action/v1.0.1/dist/index.js:8078:30)
    at Object.issue (/home/runner/work/_actions/shallwefootball/s3-upload-action/v1.0.1/dist/index.js:8082:5)
    at Object.error (/home/runner/work/_actions/shallwefootball/s3-upload-action/v1.0.1/dist/index.js:9545:15)
    at ManagedUpload.callback (/home/runner/work/_actions/shallwefootball/s3-upload-action/v1.0.1/dist/index.js:2430:21)
    at ManagedUpload.cleanup (/home/runner/work/_actions/shallwefootball/s3-upload-action/v1.0.1/dist/index.js:20775:10)
    at Request.<anonymous> (/home/runner/work/_actions/shallwefootball/s3-upload-action/v1.0.1/dist/index.js:20654:16)
    at Request.callListeners (/home/runner/work/_actions/shallwefootball/s3-upload-action/v1.0.1/dist/index.js:12939:20)
    at Request.emit (/home/runner/work/_actions/shallwefootball/s3-upload-action/v1.0.1/dist/index.js:12911:10) {
  message: '(s || "").replace is not a function',
  code: 'TypeError',
  time: 2020-07-02T16:11:58.172Z
}

Could not figure out what this is, then noticed the incorrect typing here:

https://github.com/shallwefootball/upload-s3-action/blob/7ca30b18d2c7fa3f9c51e92216317718adf41c4e/index.js#L37

and here:

https://github.com/shallwefootball/upload-s3-action/blob/7ca30b18d2c7fa3f9c51e92216317718adf41c4e/index.js#L66

Obviously, my upload has failed but I do not know why because the error handling has failed. I will provide a PR soon.