This error came up while I was developing a React Native application and tried using Axios and an API client I generated using OpenAPI Generator (and with typescript settings).
React Native isn't compliant with WHATWG URL standard, which causes this error to popup.
You need to install a package to polyfill the API client.
yarn add react-native-url-polyfill
After adding the package you also need to import the polyfill on the first line within your generated API client (or other file that is causing this error).
You can import the polyfill using: