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

Supports [email protected] #165

Merged
merged 10 commits into from
Nov 15, 2023
Merged

Supports [email protected] #165

merged 10 commits into from
Nov 15, 2023

Conversation

shawnzhu
Copy link
Member

Follow up of #164

There're several break changes on types and API.

it will need to implement axios/lib/helpers/buildURL since it could not be imported from axios anymore. see kuitos/axios-extensions#99

dependabot bot and others added 2 commits November 11, 2023 04:17
Bumps [axios](https://github.com/axios/axios) from 0.27.2 to 1.6.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](axios/axios@v0.27.2...v1.6.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
@shawnzhu shawnzhu added the enhancement New feature or request label Nov 13, 2023
if (error.isLambdaInvokeTimeout) return true;

return error.code !== 'ECONNABORTED' &&
(!error.response || (error.response.status >= 500 && error.response.status <= 599));
return error.code !== 'ECONNABORTED' && isServerSideError(error);
Copy link
Member

Choose a reason for hiding this comment

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

Should this be ! isServerSideError ?

Copy link
Member

Choose a reason for hiding this comment

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

No, I don't think so. My mistake

return (
error.response
&& (
_inRange(_get(error.response, 'StatusCode', 0) as number, 500, 600)
Copy link
Member

Choose a reason for hiding this comment

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

Before the addition of StatusCode checks, was this function failing to detect some failures?

Copy link
Member Author

Choose a reason for hiding this comment

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

this function is refactored from isRetryableError(). it checked the statusCode of http request via Axios API (AxiosResponse) only.

These lines are for checking the status code of lambda function invocation via Lambda API (InvocationResponse). I could remove this one if aws internal error during lambda invocation is not retryable.

test/adapters/helpers/apiGateway.test.ts Show resolved Hide resolved
test/alpha.test.ts Outdated Show resolved Hide resolved
test/retry.test.ts Outdated Show resolved Hide resolved
return (
error.response
&& (
_inRange(_get(error.response, 'StatusCode', 0) as number, 500, 600)
Copy link
Member Author

Choose a reason for hiding this comment

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

this function is refactored from isRetryableError(). it checked the statusCode of http request via Axios API (AxiosResponse) only.

These lines are for checking the status code of lambda function invocation via Lambda API (InvocationResponse). I could remove this one if aws internal error during lambda invocation is not retryable.

src/resolve.ts Show resolved Hide resolved
test/adapters/helpers/apiGateway.test.ts Show resolved Hide resolved
test/alpha.test.ts Outdated Show resolved Hide resolved
@shawnzhu
Copy link
Member Author

Progress

after bd7aa1c it will pass all unit tests (fell short on code coverage a little bit).
It allows using empty object to declare headers so no changes to Alpha API.

tsc --noEmit fails. I still need to fix the types since the assumption is it declares AlphaResponse.config in type AlphaOptions, which is not strict enogh.

@shawnzhu shawnzhu force-pushed the upgrade-deps branch 6 times, most recently from e7c5ddd to cbdd5e9 Compare November 14, 2023 18:12
@mdlavin
Copy link
Member

mdlavin commented Nov 14, 2023

Can you push a commit marked as breaking so the version number will be bummed?

@shawnzhu shawnzhu force-pushed the upgrade-deps branch 2 times, most recently from f2457c7 to eefbbf1 Compare November 14, 2023 19:04
@shawnzhu
Copy link
Member Author

Can you push a commit marked as breaking so the version number will be bummed?

will do in a coming commit that fixes types.

@lifeomic-probot
Copy link

lifeomic-probot bot commented Nov 14, 2023

⚠️ Detected a breaking change in commit 642b298

Merging this PR will result in a major version bump.

Created by lifeomic-probot (Enforce Semantic Commits)

@shawnzhu shawnzhu marked this pull request as ready for review November 14, 2023 20:37
src/types.ts Outdated
@@ -14,7 +14,7 @@ type SignatureV4Constructor = SignatureV4Init & SignatureV4CryptoInit;
type SignatureV4Optionals = 'credentials' | 'region' | 'sha256' | 'service';

export interface AlphaResponse<ResponseData = any, ConfigData = any> extends AxiosResponse<ResponseData> {
config: AlphaOptions<ConfigData>;
config: AlphaOptions<ConfigData> & InternalAxiosRequestConfig;
Copy link
Member Author

Choose a reason for hiding this comment

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

This change means it could re-use AlphaOptions as the type of config in AlphaResponse but response headers always exist.

"@lifeomic/eslint-config-standards": "^3.0.0",
"@lifeomic/jest-config": "^1.1.2",
"@lifeomic/typescript-config": "^1.0.3",
"@lifeomic/eslint-config-standards": "3.0.0",
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 locked it to 3.0.0 to be able to run yarn lint on node.js v14.

@shawnzhu shawnzhu requested a review from mdlavin November 14, 2023 20:41
@shawnzhu shawnzhu added the dependencies Pull requests that update a dependency file label Nov 14, 2023
@shawnzhu
Copy link
Member Author

Notice that it will need to port this change to @lifeomic/[email protected] release as a maintenance release for projects still uses aws-sdk v2

@shawnzhu shawnzhu requested review from swain and rob-snyder November 14, 2023 21:40
@mdlavin
Copy link
Member

mdlavin commented Nov 14, 2023

Notice that it will need to port this change to @lifeomic/[email protected] release as a maintenance release for projects still uses aws-sdk v2

I had the same thought, but it's a bummer that the upgrade is a breaking change. Ideally we'd somehow introduce a major version change between 4 and 5 😄

src/types.ts Outdated Show resolved Hide resolved
src/types.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@swain swain left a comment

Choose a reason for hiding this comment

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

Nice. This upgrade has been a long time coming. Thanks for doing the tedious work!

@shawnzhu shawnzhu merged commit e4adaed into master Nov 15, 2023
5 checks passed
@shawnzhu shawnzhu deleted the upgrade-deps branch November 15, 2023 19:21
Copy link

🎉 This PR is included in version 6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants