diff --git a/.changeset/khaki-bees-count.md b/.changeset/khaki-bees-count.md new file mode 100644 index 000000000..a481690e2 --- /dev/null +++ b/.changeset/khaki-bees-count.md @@ -0,0 +1,5 @@ +--- +"gitbook": patch +--- + +Fix crash when integration is triggering invalid requests. diff --git a/packages/gitbook/src/components/DocumentView/Integration/render.ts b/packages/gitbook/src/components/DocumentView/Integration/render.ts index a9a86c9e5..4e683e0dc 100644 --- a/packages/gitbook/src/components/DocumentView/Integration/render.ts +++ b/packages/gitbook/src/components/DocumentView/Integration/render.ts @@ -21,10 +21,13 @@ export async function fetchSafeIntegrationUI( request, }), - // The API can respond with a 400 error if the integration is not installed - // and 404 if the integration is not found. - // The API can also respond with a 502 error if the integration is not generating a proper response. - [404, 400, 502] + // The API can respond with certain errors that are expected to happen. + [ + 404, // Integration has been uninstalled + 400, // Integration is rejecting its own request + 422, // Integration is triggering an invalid request, failing at the validation step + 502, // Integration is failing in an unexpected way + ] ); return output;