Skip to content

fix(fetch): handle non-JSON error responses better#1324

Merged
kanadgupta merged 2 commits intonextfrom
kanad-2025-08-05/docs-upload-weirdness
Aug 6, 2025
Merged

fix(fetch): handle non-JSON error responses better#1324
kanadgupta merged 2 commits intonextfrom
kanad-2025-08-05/docs-upload-weirdness

Conversation

@kanadgupta
Copy link
Copy Markdown
Contributor

@kanadgupta kanadgupta commented Aug 5, 2025

🚥 Resolves CX-2187

🧰 Changes

a customer was uploading an excess of 150+ pages and a handful appear to consistently fail with errors that aren't particularly helpful:

🚨 Received errors when attempting to upload 2 page(s):
   - page-1.md: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
   - page-2.md: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

evidently our API is periodically responding with non-JSON despite sending a JSON content type? this updates our API response handling so we can display a friendlier error and better troubleshoot these errors when we see them.

🧬 QA & Testing

added a test and confirmed all the existing ones are still passing!

@kanadgupta kanadgupta added API Underlying issue is with the ReadMe API and not necessarily the `rdme` client itself bug Something isn't working labels Aug 5, 2025
@kanadgupta kanadgupta marked this pull request as ready for review August 6, 2025 17:38
@kanadgupta kanadgupta requested review from emilyskuo and erunion August 6, 2025 17:38
@kanadgupta kanadgupta merged commit 383123f into next Aug 6, 2025
13 checks passed
@kanadgupta kanadgupta deleted the kanad-2025-08-05/docs-upload-weirdness branch August 6, 2025 18:30
kanadgupta pushed a commit that referenced this pull request Aug 6, 2025
# [10.5.0-next.5](v10.5.0-next.4...v10.5.0-next.5) (2025-08-06)

### Bug Fixes

* **fetch:** handle non-JSON error responses better ([#1324](#1324)) ([383123f](383123f))

[skip ci]
@kanadgupta
Copy link
Copy Markdown
Contributor Author

🎉 This PR is included in version 10.5.0-next.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

kanadgupta pushed a commit that referenced this pull request Aug 22, 2025
# [10.5.0](v10.4.0...v10.5.0) (2025-08-22)

### Bug Fixes

* **fetch:** handle non-JSON error responses better ([#1324](#1324)) ([383123f](383123f))
* **openapi/upload:** custom slugs for URL uploads ([#1313](#1313)) ([ab48677](ab48677))
* **v9/docs:** migration guide + deprecation notice updates ([#1208](#1208)) ([1fa6adb](1fa6adb))

### Features

* **inspect:** splitting apart `xml` into three fine-tuned datasets ([#1305](#1305)) ([2e10328](2e10328))
* new `rage` command for printing out environment data for debugging ([#1310](#1310)) ([c773af8](c773af8))
* **openapi/upload:** docs + DX enhancements for slugs vs. legacy IDs ([#1309](#1309)) ([5272a7e](5272a7e))
* **plugins:** add `runRdmeCommand` helper ([#1292](#1292)) ([12fea84](12fea84))

[skip ci]
@kanadgupta
Copy link
Copy Markdown
Contributor Author

🎉 This PR is included in version 10.5.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

API Underlying issue is with the ReadMe API and not necessarily the `rdme` client itself bug Something isn't working released on @next released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants