axios icon indicating copy to clipboard operation
axios copied to clipboard

No Upload Progress Safari

Open dlewis23 opened this issue 1 year ago • 9 comments

Describe the bug

When uploading in Safari on MacOS or on iOS no upload progress event is fired. If you use FireFox or Chrome the upload progress is fired correctly.

To Reproduce

Use the inspector in Safari and no progress % is shown in the console.

Code snippet

let config = {
		onUploadProgress: progressEvent => {
			let percentCompleted = Math.floor((progressEvent.loaded * 100) / progressEvent.total);
			console.log(percentCompleted);
		}
	}

	axios.post('https://httpbin.org/post', data, config)
		.then(response => console.log(response));

Expected behavior

Progress of the upload should show as it does in Firefox and chrome.

Axios Version

1.7.2

Adapter Version

No response

Browser

Safari

Browser Version

17.4

Node.js Version

No response

OS

MacOS 14, iOS 17

Additional Library Versions

No response

Additional context/Screenshots

No response

dlewis23 avatar Jul 18 '24 19:07 dlewis23

Which adapter do you use fetch or xhr?

DigitalBrainJS avatar Jul 31 '24 23:07 DigitalBrainJS

I typically use XHR, but the issue happens with both.

dlewis23 avatar Aug 01 '24 13:08 dlewis23

I have the same issue on WebKit iOS 18.

totalSize is completely off until it is complete, then changes to the correct value:

total: 18446744073709552000 totalSize: 18446744073709552000

Last progress event returns the correct values:

total: 59461221 totalSize: 59461221

fred-boink avatar Sep 20 '24 20:09 fred-boink

I have the same issue in version 1.7.4 and 1.7.7. This issue appeard after updating to ios 18 and only exists on safari. Is there currently any workaround for this?

Andrew920 avatar Sep 21 '24 10:09 Andrew920

I have same problem

echoaxis1 avatar Sep 22 '24 13:09 echoaxis1

I have reported this issue to Apple/Safari because I don't believe it's something we can fix its something with Safari/MacOS itself. https://bugs.webkit.org/show_bug.cgi?id=277286

dlewis23 avatar Sep 22 '24 13:09 dlewis23

Has anyone tested the issue with the fetch adapter instead of the default xhr? In theory, it shouldn't have the same issue.

DigitalBrainJS avatar Sep 22 '24 16:09 DigitalBrainJS

Has anyone tested the issue with the fetch adapter instead of the default xhr? In theory, it shouldn't have the same issue.

just tested it. still an issue. it’s a safari issue.

xcaeser avatar Oct 19 '24 20:10 xcaeser

@DigitalBrainJS this problem happens with both XHR and Fetch. It's a bug with safari itself. I have reported the bug to Apple, others should say they have the issue here so it gets more eyes on it: https://bugs.webkit.org/show_bug.cgi?id=277286

dlewis23 avatar Oct 22 '24 20:10 dlewis23

onDownloadProgress is also not working on Safari

ty-yeo avatar Feb 05 '25 04:02 ty-yeo

this seems to be still not working. Does anyone have an idea for a workaround?

quarantaquatro avatar Mar 14 '25 21:03 quarantaquatro

onDownloadProgress is also not working on Safari

For my case, The problem was caused by Safari not supporting Content-type: x-mixed-replace, Not an axios bug for me.

https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content

ty-yeo avatar Mar 17 '25 06:03 ty-yeo

closing as this seems to be a safari issue. i will add this as something to note or add to the docs

jasonsaayman avatar Sep 03 '25 19:09 jasonsaayman