matrix-org / matrix-org/matrix-js-sdk

browser-request is not compatible with react-native

Open
#875 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Help Wanted T-Defect
Dominant language
TypeScript
Stars
2.2k
Forks
704
Avg merge
1d 20h
Merged PRs (30d)
40

Description

Production build in react-native fails because the `browser-request` library tries to call `document.createElement` to check for cross-domain request (for CORS).

In React Native, `document` is not defined and CORS is not relevant.

The `browser-request` library has not been updated since 2014, so upstream fix seems very unlikely.

I propose dependency update to https://www.npmjs.com/package/xmlhttp-request which is a fork of `browser-request` that fixed this problem.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the package declaration for browser-request and inspect how the SDK's React Native production build resolves it. Evaluate the proposed xmlhttp-request replacement, then verify that the production build no longer reaches document.createElement and that the dependency is updated consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.