Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Axios 1.2.0 response data is unreadable #5328

Closed
spellforce opened this issue Dec 1, 2022 · 15 comments
Closed

Axios 1.2.0 response data is unreadable #5328

spellforce opened this issue Dec 1, 2022 · 15 comments

Comments

@spellforce
Copy link

Describe the bug

When reponse is 200, reponse.data is garbled.

code:

`const axios = require('axios');

axios
.request({
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false,
},
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
env: {
FormData: {
LINE_BREAK: '\r\n',
DEFAULT_CONTENT_TYPE: 'application/octet-stream',
},
Blob: null,
},
baseURL: 'https://baidu.com/',
method: 'get',
url: '/',
})
.then(function (response) {
console.log(response.data, 'response');
})
.catch(function (error) {
console.log(error);
});
`
image

To Reproduce

No response

Code snippet

No response

Expected behavior

No response

Axios Version

1.2.0

Adapter Version

XHR, HTTP

Browser

Nodejs

Browser Version

Nodejs

Node.js Version

16.17.1

OS

osx 13.1

Additional Library Versions

No need

Additional context/Screenshots

![image](https://user-images.githubusercontent.com/12042870/205060898-a55b8da5-877a-49de-afda-b17e36de8a88.png)
@riimuru
Copy link

riimuru commented Dec 1, 2022

@spellforce You could fix the problem quickly by adding 'accept-encoding: "*" to the headers.

@roybeitner
Copy link

roybeitner commented Dec 1, 2022

I find it absolutely insane that a package this popular has such a major bug for 9 days and no one is doing s**t.
Need to migrate to Node v18 fetch asap.

@OpenSource03
Copy link

I find it absolutely insane that a package this popular has such a major bug for 9 days and no one is doing s**t.
Need to migrate to Node v18 fetch asap.

Exactly, this is really getting ridiculous... Really not sure how this is even possible...

@spellforce
Copy link
Author

@spellforce You could fix the problem quickly by adding 'accept-encoding: "*" to the headers.

It works. Thanks.

@spellforce
Copy link
Author

I find it absolutely insane that a package this popular has such a major bug for 9 days and no one is doing s**t. Need to migrate to Node v18 fetch asap.

The library is not stable at all, and there have been many obvious bugs before

@huihuimoe
Copy link

It works. Thank you.

@Apokalypt
Copy link

If a real fix (not a hack one XD ) is provided by the library tell me please :(

@simenflatby
Copy link

If a real fix (not a hack one XD ) is provided by the library tell me please :(

@Apokalypt You can subscribe to this issue on the top right of the page. Then you will get notified when it is closed.

@akateliev
Copy link

I've lost 2 hours debugging existing code. Amazing bug.
btw: 'accept-encoding: "*" fixed the issue for me.

@keytrap-x86
Copy link

This issue will be fixed this weekend hopefully
#5306 (comment)

nathanfiscus added a commit to nathanfiscus/zigbee-herdsman-converters that referenced this issue Dec 2, 2022
This addresses an issue in Axios 1.2.0 that causes data to be unreadable. See axios/axios#5328
yuko1101 added a commit to yuko1101/enka-network-api that referenced this issue Dec 3, 2022
Koenkk pushed a commit to Koenkk/zigbee-herdsman-converters that referenced this issue Dec 3, 2022
* Work Around to Address Axios Issue

This addresses an issue in Axios 1.2.0 that causes data to be unreadable. See axios/axios#5328

* lint
@julian-hoch
Copy link

Same issue. You can fix for requests with accept-encoding, but not sure how to deal with post requests - these always seem to get compressed. For now switching back to 1.1.3.

@frogburger
Copy link

This is scary for two reasons: 1 it is a key problem (granted that there is a workaround), and 2 how come this version passed the regression testing (seems to be quite obvious to replicate)?

lucaswerkmeister added a commit to lucaswerkmeister/m3api that referenced this issue Dec 4, 2022
It has a pretty bad bug (axios/axios#5328) where it will fail to decode
responses that don’t have a Content-Length response header set; a fix is
already committed, but not yet released.

npm semver doesn’t have a syntax to exclude a specific version, but we
can simulate it by combining two ranges. (It’s not clear whether the
next axios release will be 1.2.1 or 1.3.0, but ^1.2.1 should match
either.)
@deepak786
Copy link

Use release 1.2.1

@WayneEllery
Copy link

Yes. This is now fixed in 1.2.1

@jasonsaayman
Copy link
Member

Please use 1.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests