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
Property 'Authorization' does not exists on type 'AxiosHeaders' after upgrade to 1.2.2 #5416
Comments
@DigitalBrainJS I guess this was introduced in the following line of PR #5375: And seems like this issue is similar to what's happening in this issue: |
Oh, maybe it's already fixed in this PR: |
Having the same issue so following... |
same here, rolling back version update so far |
@jasonsaayman would be great if you could create a hot fix release ( semver patch ) with #5420. |
Here's how I fixed it
|
I locked my version to 1.2.1 for now, until this is resolved |
I was in 1.2.1 when it happened. Thought it was fixed in 1.2.2 so I upgraded. Still same issue. |
just checked again, on |
Correct. The following can still be done in 1.2.1
|
Try something like this if you are using Axios with TS -> |
Thanks, this works for me |
I could solve it using the following: const headers = { ...config.headers } as Partial<AxiosRequestHeaders>;
headers['appversion'] = `${environment.versionNumber}.${environment.buildNumber}`;
headers['timezone_name'] = dayjs.tz.guess();
headers['content-location'] = dayjs.tz.guess();
headers['Authorization'] = `Bearer ${token}`;
... |
I am also having this issue - could anyone clarify if this is an intended behaviour after 1.2.2 or is this a "bug" which will likely be fixed in a future release? |
It is not intended and should be considered as a bug, but @jasonsaayman always needs a bit of time. I actually don't get why he is the only one, who can create releases and how he can relax so long, when this library is so commonly used. Besides, it does not get less money through opencollective & co. |
This is a bug because according to Semantic Versioning, incrementing the patch number must be backward compatible. In this case, the pipeline of a system using version "~1.2.0" or "~1.2.1" will fail |
thanks.. it work for me to |
@tada5hi thanks for this let me address your concerns. I think saying I always need a bit of time is on the hot take side of things, I have been working on Axios for quite a while and before I started there were about 1k open issues, 200 open PRs and much fewer and less frequent releases. I am not "relaxing so long", I have a real life too with commitments etc. To mention open collective and money is pretty tactless and in poor taste. I don't personally gain anything from fundraising and don't even use it to pay for axios-http.com domain or the hosting of that site which all come directly out of my own personal funds. We only collect money on open collective and GitHub so that we can apply it to things like issue hunt and if possible when funding looks good get someone onboard in a part-time position to help streamline the project. I am currently the only person who can create a release, this is true, I am looking at making this more streamlined however that in itself is tricky as it can lead to poor-quality releases if not done correctly. Also as you said this is a very popular library and I don't think handing out that ability to release to just anyone would be a good idea. To address the SemVer issue, many times we release something and a side effect occurs that we don't have enough tests to cover or check for this, in turn, causes that in the end our release was tagged with the incorrect version retrospectively. I know this is a problem and we are doing our best to make this happen less frequently. One of the ways we wanted to do this was pre-release's however since so few people care to invest in the small amount of time it would take to install and test these pre-releases that route does not seem so viable so I am fully open to suggestions in this area and if anyone wants me to create a pre-release mailing list or some other way of notifying pre-release testers about these releases or implement something like a beta programme please let me know. Lastly, this is a community-driven project, if you don't like something reach out and we can work together to make it better and improve the project as a whole. Maybe add more tests or increase the effectiveness of the current suite to cover more impact areas. Help with pre-release testing, help with issues and aggregating and tagging them better, help with PR reviews or even suggestions on how to make releases better with fewer potential side effects and have a more solid pre-release testing programme etc. But don't just leave a comment that shifts the blame solely onto me, that is not in the spirit of open source and that is not why I got involved in open source. |
First of all, I would like to apologize for the way I expressed my concerns and I greatly appreciate your work and that of the other contributors. I was just very frustrated that features that worked <v1.0 gradually stopped working during the v1+ releases and I would have been very happy about an earlier feedback from you no matter in which way in many of the problem cases.
I completely agree with you, and I fully understand when a new feature causes problems, but it shouldn't circularly affect existing features.
As noted, I was just frustrated that certain features kept failing to work at one time or another and negatively impacted one or another production build. If you need support to review pull requests or structure the code, I'm very happy to help. I would also be happy to help you move the project to typescript, so you can also avoid some errors you might otherwise miss. I would also like to apologize profusely at this point for the way and I completely agree with almost everything you said. Many greetings |
@tada5hi thanks for your reply. Can you reach out to me by email, then we can discuss some aspects further? |
@jasonsaayman With pleasure, I would also like to thank you for your detailed and kind message. |
folks, all of us have bugs in our software and @jasonsaayman raised a good point: this package needs more tests. how can we help and who wants to jumb on board? |
It's really not a problem without a workaround so it should all be okay. We shouldn't be too hard on this. Keep up the good work @jasonsaayman ! |
@tada5hi Unfortunately, in the real world, this is practically unattainable. Regression bugs occur even in large commercial projects with huge QA departments. Users should not bump the package dependencies in production without QA testing before deploying, but judging by the issues, this happens. Usually, it doesn't make sense for users to update the version of Axios if their code works. In production, there is always a rule - do not touch what works, unless you get a security vulnerability warning from npm. Therefore, new versions of packages should only be used in the development environment when you are trying out new features. |
@DigitalBrainJS Here I would like to contradict you vehemently. This may be the case for end applications, but not for libraries that are built on top of them. A strategy like yours contributes to the fact that we live more and more in a dependency hell, where packages are based on different major, minor versions of the same package, which only increases the build size.
I think we agree here that bug fixes should be fixed as soon as possible (ASAP). |
Have to agree with @tada5hi on upgrading packages in production apps. We run & maintain a large-scale application, and if we left package updates alone (except for vulnerabilities), we'd be amassing some serious technical debt (and time debt) as libraries we depend on continued to add non-breaking changes/features. Bottom line: avoid tech & time debt, review the changelogs in your dependencies and keep those packages up to date! Otherwise, it's a much more daunting task down the road, and upgrading to a major version could be a lot more work. |
@tada5hi I am not saying that packages should not be updated at all, I am just saying that updating packages should be done consciously, tested in the development environment, and only then updated on the production server. Unless you have a practical reason to upgrade a package, it's best to refrain from upgrading just for the sake of upgrading. |
@DigitalBrainJS i never claimed that testing in the development environment was or should be skipped. |
keep axios at 1.2.1 until axios/axios#5416 is closed
Since #5420 was merged and released in @andreylh can you confirm and close if so? |
hint for everyone: don't use ^ and ~ in your package.json ;) |
@kirill-linnik Nothing wrong with |
on npm we still have |
Oh, looks like the |
Seems like another new release of |
It's not help to me I sovled it:
|
Since this is a bug, rather than working around it with casting I chose to use Since the code still functionally worked even though the type didn't say it would, I found this to be the least invasive change while still allowing the upgrade. Wanted to share in case it helped anyone, thanks for all the time and effort the maintainers and contributors put into this library and its community. Have a great week all 🙂 |
Wow, today I learned about |
if (typeof config.headers?.set === 'function') {
config.headers.set('Authorization', `Bearer ${token}`);
} |
Am I missing something or 1.2.3 was not released eventually? |
I think it was reverted? Not sure. But for now this should help you v1.2.2
|
I saw the many fixes in this thread but I was wondering if there's another issue that prevents this fix from being formally released. |
Reference [GitHub Issue](axios/axios#5416)
I tried this and it works for me, you can also try it. axiosInstance.interceptors.request.use( |
V1.2.3 was released and fixed it. |
@andreylh can you confirm that |
Dont't upgrade rash to |
Summary
I'm getting the following error after upgrading axios to version 1.2.2:
The same snippet of code is working on version 1.2.1:
Environment
The text was updated successfully, but these errors were encountered: