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

build(deps): bump reqwest from v0.11.18 to v0.12.2 #4247

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

pixincreate
Copy link
Member

@pixincreate pixincreate commented Mar 28, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

This PR updates reqwest dependency version from 0.11.18 to 0.12.2 to address frequent disconnections and connection reset errors.

The major here is that we use actix_web along with reqwest. With reqwest releasing 0.12.0, http crate version was bumped from 0.x to 1.x while on actix_web v4.5.1 it is still on version v0.2.9. This version mismatch is what is handled here in this PR.

Also, in webhook.rs, it is not possible to directly convert headers that we get from reqwest to match with actix_web unless actix_web updates http version to 1.x. Also, since reqwest does not support HttpRequest explicitly, we cannot directly use that either which led to manual conversion. (Open for discussions on this)

reqwest changelog can be found here and notable breaking changes can be found here

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

Dependency update has been done in order to address frequent connection_reset errors.

Closes #4248

How did you test it?

Basic tests

  • Create { Merchant + API Key + MCA }
  • Update API Key
  • Make Payment
  • Refund
image

Postman tests

Once they succeeded, ran the postman collection for confirmation

image image

Webhooks

image

Clickhouse

Set up clickhouse by following the guide here
http:localhost:8090

image image

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

@pixincreate pixincreate added A-dependencies Area: Dependencies S-waiting-on-review Status: This PR has been implemented and needs to be reviewed C-refactor Category: Refactor labels Mar 28, 2024
@pixincreate pixincreate self-assigned this Mar 28, 2024
@pixincreate pixincreate requested review from a team as code owners March 28, 2024 11:56
Comment on lines 1216 to 1233
/*
This is a temporary fix for converting http::HeaderMap from actix_web to reqwest
Once actix_web upgrades the http version from v0.2.9 to 1.x, this can be removed
*/
fn convert_headers(
actix_headers: &actix_web::http::header::HeaderMap,
) -> reqwest::header::HeaderMap {
let mut reqwest_headers = reqwest::header::HeaderMap::new();
for (name, value) in actix_headers.iter() {
if let Ok(name) = reqwest::header::HeaderName::from_str(name.as_str()) {
if let Ok(value) = reqwest::header::HeaderValue::from_bytes(value.as_bytes()) {
reqwest_headers.insert(name, value);
}
}
}
reqwest_headers
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can have a discussion on this.
the pr to update http crate is open here: actix/actix-web#3208

@pixincreate pixincreate changed the title chore(deps): [test_utils] bump reqwest from v0.11.18 to v0.12.2 chore(deps): bump reqwest from v0.11.18 to v0.12.2 Mar 28, 2024
@pixincreate pixincreate changed the title chore(deps): bump reqwest from v0.11.18 to v0.12.2 build(deps): bump reqwest from v0.11.18 to v0.12.2 Mar 28, 2024
crates/router/src/core/webhooks.rs Outdated Show resolved Hide resolved
* 'main' of github.com:juspay/hyperswitch:
  refactor(core): removed the processing status for payment_method_status (#4213)
  docs(README): remove link to outdated early access form
  build(deps): bump `error-stack` from version `0.3.1` to `0.4.1` (#4188)
  chore(version): 2024.04.01.0
  feat(mandates): allow off-session payments using `payment_method_id` (#4132)
  ci(CI-pr): determine modified crates more deterministically (#4233)
  chore(config): add billwerk base URL in deployment configs (#4243)
  feat(payment_method): API to list countries and currencies supported by a country and payment method type (#4126)
  chore(version): 2024.03.28.0
  refactor(config): allow wildcard origin for development and Docker Compose setups (#4231)
  fix(core): Amount capturable remain same for `processing` status in capture (#4229)
  fix(euclid_wasm): checkout wasm metadata issue (#4198)
  fix(trustpay): [Trustpay] Add error code mapping '800.100.100'  (#4224)
  feat(connector): [billwerk] add connector template code (#4123)
  fix(connectors): fix wallet token deserialization error  (#4133)
  fix(log): adding span metadata to `tokio` spawned futures (#4118)
  chore(version): 2024.03.27.0
  fix(connector): [CRYPTOPAY] Skip metadata serialization if none (#4205)
  fix(connector): [Trustpay] fix deserialization error for incoming webhook response for trustpay and add error code mapping '800.100.203' (#4199)
  fix(core): make eci in AuthenticationData optional (#4187)
lsampras
lsampras previously approved these changes Apr 1, 2024
Copy link
Member

@lsampras lsampras Apr 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this increase in min stack size needed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not comfortable with us constantly bumping the number without attempting to address it.

Either revert this change, or if it is absolutely required, update the comment to reflect the updated number.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started to get stack overflow on every run (stripe CI) resulting server shutdown until I bumped the min stack to 8 MiB which is why I bumped the number.

Since the bump has already been done here, the change is reverted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not comfortable with us constantly bumping the number without attempting to address it.

Either revert this change, or if it is absolutely required, update the comment to reflect the updated number.

crates/pm_auth/Cargo.toml Outdated Show resolved Hide resolved
dracarys18
dracarys18 previously approved these changes Apr 1, 2024
ArjunKarthik
ArjunKarthik previously approved these changes Apr 1, 2024
Copy link
Contributor

@ArjunKarthik ArjunKarthik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connector changes LGTM

@pixincreate
Copy link
Member Author

After today's discussions, it has been decided to better wait before getting this PR merged as actix_web has an open PR that updates http crate version to 1.x from 0.2.9 (which might take some time).

Once that is done, it will be easier for us to update the dependencies all together (actix_web, http and, reqwest) to their latest versions.

With that said, I'll be closing this PR to avoid any conflicts or confusion. I'll be raising yet another PR on behalf of this (just to keep the history clean) addressing the above mentioned changes.

@pixincreate pixincreate closed this Apr 1, 2024
@pixincreate pixincreate deleted the update-reqwest branch April 1, 2024 17:53
@pixincreate pixincreate removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Apr 2, 2024
@Narayanbhat166 Narayanbhat166 restored the update-reqwest branch May 4, 2024 04:50
@Narayanbhat166 Narayanbhat166 reopened this May 4, 2024
This reverts commit ab97656, reversing
changes made to b960e9f.
@pixincreate pixincreate requested review from a team as code owners May 4, 2024 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dependencies Area: Dependencies C-refactor Category: Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dependency Update] update reqwest from version 0.11.18 to 0.12.2
6 participants