-
Notifications
You must be signed in to change notification settings - Fork 19
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
Fix service crash when non-arsenal errors is sent to delete route #2267
Conversation
Hello williamlardier,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## development/8.1 #2267 +/- ##
===================================================
+ Coverage 64.90% 66.12% +1.22%
===================================================
Files 215 215
Lines 17298 17325 +27
Branches 3514 3552 +38
===================================================
+ Hits 11228 11457 +229
+ Misses 6055 5853 -202
Partials 15 15 ☔ View full report in Codecov by Sentry. |
2aa80d8
to
18adec6
Compare
Request integration branchesWaiting for integration branch creation to be requested by the user. To request integration branches, please comment on this pull request with the following command:
Alternatively, the |
8e3c732
to
88334eb
Compare
e4dae6d
to
2079ec6
Compare
818c98c
to
8e830fe
Compare
- Error may be returned by modules not using Arsenal - In this case, any non-arsenal error reaching this code would cause a crash of the service. Issue: ARSN-441
Arsenal routes today are used in cloudserver, that calls these callback functions using, most of the time, Arsenal errors. But sometimes, especially when using modules, such as hdclient or others, we might not return an Arsenal error. In this case, we still try to access undefined properties, eventually leading to strange responses to the client. The changes are introducing support for traditional Error objects, so that we can safely pass any error from a module used in an API call.
Issue: ARSN-441
Issue: ARSN-441
f34a2cd
to
4f64195
Compare
/create_integration_branches |
Integration data createdI have created the integration data for the additional destination branches.
The following branches will NOT be impacted:
You can set option
The following options are set: create_integration_branches |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
The following options are set: create_integration_branches |
4f64195
to
6a61a1e
Compare
History mismatchMerge commit #4f641951bf8210352d7b0cbc96e3872538f7a99c on the integration branch It is likely due to a rebase of the branch Please use the The following options are set: create_integration_branches |
/reset |
Reset completeI have successfully deleted this pull request's integration branches. The following options are set: create_integration_branches |
Integration data createdI have created the integration data for the additional destination branches.
The following branches will NOT be impacted:
You can set option
The following options are set: create_integration_branches |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
The following options are set: create_integration_branches |
lib/s3routes/routes/routeWebsite.ts
Outdated
@@ -30,7 +30,7 @@ export default function routerWebsite( | |||
// request being redirected | |||
if (redirectInfo) { | |||
if (err && redirectInfo.withError) { | |||
return routesUtils.redirectRequestOnError(err, | |||
return routesUtils.redirectRequestOnError(err as ArsenalError, |
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.
do you know why we need type coercion here?
callApiMethod
already defines that the callback receives an ArsenalError
error...
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.
It's because the error we can currently get from APIs is defined in
export type CallApiMethod = (
methodName: string,
request: http.IncomingMessage,
response: http.ServerResponse,
log: RequestLogger,
callback: (err: ArsenalError | Error | null, ...data: any[]) => void,
) => void;
So it can be a non-arsenal error, this change was made on purpose so we benefit from ts checks everywhere and cover all paths that could lead to errors. The case of website is special, we already know it can only be arsenal errors. All of this will be removed once we have the "long term" solution in place
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.
indeed, I missed the alternate types 🤦♂️
but it seems a bit dangerous to just "expect" these will be arsenal errors and blindly trust this is the case : if we want to rely on typescript to detect errors, best do it all the way and add an early check that it is indeed an ArsenalError (or just don't cast, and allow redirectRequestOnError
to handle any Error
)
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.
I updated the function so that it accepts non-arsenal errors - i kept the logic to dynamically recreate an arsenal error in this case, so we minimize the changes (we still need to return an Arsenal error today to the client).
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.
👍, but then we should remove the type-coercion altogether
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.
yes... thanks
6a61a1e
to
732cfa8
Compare
History mismatchMerge commit #6a61a1ef32940fb171ede13e0bce18dc581c3728 on the integration branch It is likely due to a rebase of the branch Please use the The following options are set: create_integration_branches |
/reset |
Reset completeI have successfully deleted this pull request's integration branches. The following options are set: create_integration_branches |
Integration data createdI have created the integration data for the additional destination branches.
The following branches will NOT be impacted:
You can set option
The following options are set: create_integration_branches |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
The following options are set: create_integration_branches |
/approve |
I have successfully merged the changeset of this pull request
The following branches have NOT changed:
Please check the status of the associated issue ARSN-441. Goodbye williamlardier. The following options are set: approve, create_integration_branches |
Fixes a crash when the error we receive from the rout is not an Arsenal error (which is a possible and valid case).