-
Notifications
You must be signed in to change notification settings - Fork 192
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
PDE-5774 fix(core): Catch HTTP 500 along with status codes >500 in RPC client #974
Conversation
Ohh, 500 is a valid HTTP response for legacy reasons. I forgot! |
Following this PR, we should keep the retry logic for 5xx errors. |
@@ -108,7 +108,7 @@ const createRpcClient = (event) => { | |||
try { | |||
res = await request(req); | |||
|
|||
if (res.status > 500) { | |||
if (res.status >= 500) { |
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.
HTTP 500 is now a non-standard response code (note this PR is targeting a major release branch as this could be a breaking change)
@@ -51,10 +51,10 @@ const mockRpcGetPresignedPostCall = (key) => { | |||
}); | |||
}; | |||
|
|||
const mockRpcFail = (error) => { | |||
const mockRpcFail = (error, status = 400) => { |
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.
HTTP 400 is the default error code for manual failures in the RPC API now, so I've set it as the default for this test
mocky.mockRpcFail('this is an expected explosion'); | ||
mocky.mockRpcFail('this is an expected explosion'); | ||
mocky.mockRpcFail('this is an expected explosion'); | ||
mocky.mockRpcFail('this is an expected explosion', 500); |
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.
The explode
RPC method actually throws an HTTP 500 via an exception being raised 😅
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.
🙏
051bfff
into
zapier-platform-major-release-17.0.0-dev
We see
Got id undefined but expected ID_NUMBER when calling RPC
errors when it comes to RPC endpoints returning a 500 response. Inspecting the code, I believe we should likely catch the error before we checkres.content.id
.After this change is released, we should update our log stream alarms to ALSO consider the
Unable to reach the RPC server
text instead of just theGot id ${res.content.id} but expected ${id} when calling RPC
text. Both texts should be viable since we could have apps still running on previous versions.