Skip to content
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

Replace node-fetch with native fetch in tests and docs #1327

Closed
wants to merge 1 commit into from

Commits on Aug 21, 2024

  1. updated node-fetch (#1327)

    Summary:
    Pull Request resolved: #1327
    
    Updating `node-fetch` to the latest version caused tests in `packages/metro/src/integration_tests/__tests__/server-test.js` to fail. Running each test case inside the file failed individually, but there seems to have been a race condition between the tests causing subsequent tests to fail with the following error:
    ```
    FetchError: request to http://localhost:10028/import-export/index.bundle?platform=ios&dev=true&minify=false failed, reason: socket hang up
    ```
    It happens because the "connection: close" header is removed in the latest version of `node-fetch`: node-fetch/node-fetch#1765 and can be fixed by adding this header manually to fetches.
    ```
    fetch('path', {headers: {'Connection': 'close'}});
    ```
    This diff introduces a workaround where we add that header, however `fetch` is expected to work even without it when the following bug is fixed: https://github.com/nodejs/node/issues/54484
    
    Reviewed By: robhogan
    
    Differential Revision: D61336391
    vzaidman authored and facebook-github-bot committed Aug 21, 2024
    Configuration menu
    Copy the full SHA
    fcdefe8 View commit details
    Browse the repository at this point in the history