-
Notifications
You must be signed in to change notification settings - Fork 224
Closed
algolia/api-clients-automation
#3684Description
🐛 Current behavior
I'm encountering an issue while using the algoliasearch
package in a React Native app. The error occurs when Metro bundler tries to resolve the url
module, which is not found within the project or node_modules
.
Error:
Error: Unable to resolve module url from /Users/user/Documents/myapp/node_modules/@algolia/requester-node-http/src/echoRequester.ts: url could not be found within the project or in these directories:
node_modules
../../../node_modules
> 1 | import { URL } from 'url';
| ^
2 |
3 | import { createEchoRequester } from '@algolia/client-common';
4 | import type { Requester } from '@algolia/client-common';
at ModuleResolver.resolveDependency (/Users/user/Documents/myapp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:178:15)
at DependencyGraph.resolveDependency (/Users/user/Documents/myapp/node_modules/metro/src/node-haste/DependencyGraph.js:264:43)
at Object.resolve (/Users/user/Documents/myapp/node_modules/metro/src/lib/transformHelpers.js:170:21)
at resolveDependencies (/Users/user/Documents/myapp/node_modules/metro/src/DeltaBundler/graphOperations.js:466:33)
at processModule (/Users/user/Documents/myapp/node_modules/metro/src/DeltaBundler/graphOperations.js:232:31)
at async addDependency (/Users/user/Documents/myapp/node_modules/metro/src/DeltaBundler/graphOperations.js:361:18)
at async Promise.all (index 0)
at async processModule (/Users/user/Documents/myapp/node_modules/metro/src/DeltaBundler/graphOperations.js:279:3)
at async addDependency (/Users/user/Documents/myapp/node_modules/metro/src/DeltaBundler/graphOperations.js:361:18)
at async Promise.all (index 2)
The issue seems to be that React Native's Metro bundler cannot resolve the url
module, which is part of Node.js' core modules. This problem occurs specifically in the file echoRequester.ts
from the @algolia/requester-node-http
package, which imports the URL
class from url
.
🔍 Steps to reproduce
- Install dependencies:
yarn add algoliasearch react-instantsearch-core
- Attempt to run a React Native app with Metro bundler on iOS.
- The error appears during the bundling process, specifically when trying to resolve the
url
module.
Live reproduction
React InstantSearch
💭 Expected behavior
The algoliasearch
package should not rely on Node.js core modules like url
, which are not available in React Native environments.
Package version
algoliasearch Version: 5.2.5 - react-instantsearch-core Version: 7.13.0
Operating system
macOS 14.6.1
Browser
Google Chrome
Code of Conduct
- I agree to follow this project's Code of Conduct
alexphiev, benoitvallon and charithnidarsha
Metadata
Metadata
Assignees
Labels
No labels