Skip to content

fix: don't import axios into RN SDK - #3853

Open
szuperaz wants to merge 3 commits into
V10from
fix-do-not-import-axios-directly
Open

szuperaz wants to merge 3 commits into
V10from
fix-do-not-import-axios-directly

Conversation

@szuperaz

@szuperaz szuperaz commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

https://linear.app/stream/issue/REACT-1225/ensure-stream-chat-js-parses-api-error-correctly-if-multiple-axios

Avoid importing axios from RN SDK. It can cause duplicate copies of Axios.

@Stream-SDK-Bot

Copy link
Copy Markdown
Contributor

SDK Size

title develop branch diff status
js_bundle_size 2033 KB 2014 KB -19551 B 🚀

Comment thread package/src/utils/installNativeMultipartAdapter.ts
Comment thread package/src/utils/__tests__/installNativeMultipartAdapter.test.ts
Comment thread package/src/utils/__tests__/installNativeMultipartAdapter.test.ts Outdated
szuperaz added a commit to GetStream/stream-chat-js that referenced this pull request Oct 13, 2026
…1909)

https://linear.app/stream/issue/REACT-1225/ensure-stream-chat-js-parses-api-error-correctly-if-multiple-axios

Noticed this while I was checking [duplicate message id
handling](#1907) in v10.
In RN SampleApp, this doesn't work correctly because SampleApp has two
copies of axios:
- One from `stream-chat` installed by SampleApp
- One from the SDK's `stream-chat` copy
- When RN calls `installNativeMultipartAdapter,` it replaces SampleApp's
axios adapter with the RN SDK's adapter copy and `error instanceof
AxiosError` will always return `false`, which meant errors weren't
parsed properly
- The root cause is that RN shouldn't import from `axios`, fixed here:
GetStream/stream-chat-react-native#3853
- Still, this fix makes sense regardless of RN fixed, stream-chat-js is
updated to do a more robust `isAxiosError(error)` check, instead of
relying on `instanceof`

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants