-
Notifications
You must be signed in to change notification settings - Fork 277
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
Remove Axios #2006
base: dev
Are you sure you want to change the base?
Remove Axios #2006
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work. Also a good catch that Native fetcher needs some extra unit tests.
Still, some things I'd like you to take a look at and adjust. Please check the comments.
packages/create-sitecore-jss/src/templates/nextjs-styleguide-tracking/src/lib/data-fetcher.ts
Outdated
Show resolved
Hide resolved
packages/sitecore-jss-nextjs/src/editing/editing-render-middleware.ts
Outdated
Show resolved
Hide resolved
@@ -47,15 +47,14 @@ | |||
"eslint": "^8.56.0", | |||
"eslint-plugin-jsdoc": "48.7.0", | |||
"mocha": "^10.2.0", | |||
"nock": "^13.0.5", | |||
"nock": "14.0.0-beta.7", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to comment on why this specific version is used, for history.
Using beta version to fix this issue: nock/nock#2397 and allow testing for component library service
Using specific beta.7 version to not encounter this error: nock/nock#2789
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good! See some questions/comments below
Applications are failing to build/start:
- Angular sxp
- Next.js styleguide application types check is failing
- Next.js xmcloud application types check is failing
CHANGELOG.md
Outdated
@@ -22,6 +22,8 @@ Our versioning strategy is as follows: | |||
### 🐛 Bug Fixes | |||
|
|||
* `[sitecore-jss-nextjs]` Fixed handling of ? inside square brackets [] in regex patterns to prevent incorrect escaping ([#1999](https://github.com/Sitecore/jss/pull/1999)) | |||
* `[sitecore-jss]``[create-sitecore-jss]``[sitecore-jss-nextjs]``[sitecore-jss-react]``[sitecore-jss-dev-tools]``[sitecore-jss-vue]` Remove Axios ([#2006](https://github.com/Sitecore/jss/pull/2006)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chengelog entry should mention all the removed and replaced API references. However, more details should be mentioned in upgrade guide
Also, it's a breaking change, not a bugfix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@addy-pathania Changelog is unchanged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aah i forgot push my last commit.
packages/sitecore-jss-nextjs/src/editing/editing-render-middleware.ts
Outdated
Show resolved
Hide resolved
packages/create-sitecore-jss/src/templates/nextjs-styleguide-tracking/src/lib/data-fetcher.ts
Outdated
Show resolved
Hide resolved
expect(layoutServiceData.headers['X-Forwarded-For']).to.equal('192.168.1.10'); | ||
expect(layoutServiceData.data).to.deep.equal({ | ||
.then((layoutServiceData: LayoutServiceData & NativeDataFetcherConfig) => { | ||
if (layoutServiceData.headers instanceof Headers) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
layoutServiceData
can't contain headers
, so you are not verifying headers anymore
check rest of unit tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@addy-pathania we are still missing headers
configuration and verification in unit tests
.reply(200, (_, requestBody) => ({ | ||
requestBody: requestBody, | ||
data: { sitecore: { context: {}, route: { name: 'xxx' } } }, | ||
headers: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are not testing response headers anymore, check rest of unit tests as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@addy-pathania we are still missing headers
configuration and verification in unit tests
packages/create-sitecore-jss/src/templates/nextjs-sxa/src/pages/api/sitemap.ts
Show resolved
Hide resolved
packages/create-sitecore-jss/src/templates/nextjs-sxa/src/pages/api/sitemap.ts
Outdated
Show resolved
Hide resolved
.reply(200, (_, requestBody) => ({ | ||
requestBody: requestBody, | ||
data: { sitecore: { context: {}, route: { name: 'xxx' } } }, | ||
headers: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@addy-pathania we are still missing headers
configuration and verification in unit tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, it's close to be finished!
See one re-opened comment above, related to "headers" test, still missing
Description / Motivation
This change is motivated by the security vulnerabilities found with the Axios library. This PR removes the default use of Axios for data fetching across the monorepo and transitions to the native fetch API.
Testing Details
Types of changes