I have a React application and i've been trying to make axios requests to an API ignoring SSL verification like this:
const https = require('https');
const axios = require('axios');
const agent = new https.Agent({
rejectUnauthorized: false
});
axios.get('https://example.com', { httpsAgent: agent });
But I have this error:
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "https": require.resolve("https-browserify") }'
- install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "https": false }
The React app was created using npm create-react-app
.
I've tried to install https via npm install https
, and to install https-browserify, but got the same error.
I'm using nodejs v16.13.2 and react 18.1.0
Why am I getting this error?. Thanks in advance.