I\'m trying to make a request with axios to an api endpoint and I\'m getting the following error: Error: unable to verify the first certificate
It seems
For me, when the my application is running in development mode, I have disabled the rejectUnauthorized directlly in axios.defaults.options. This work very weel. Don't do this in production mode.
import https from 'https'
import axios from 'axios'
import config from '~/config'
/**
* Axios default settings
*/
axios.defaults.baseURL = config.apiURL
/**
* Disable only in development mode
*/
if (process.env.NODE_ENV === 'development') {
const httpsAgent = new https.Agent({
rejectUnauthorized: false,
})
axios.defaults.options = httpsAgent
// eslint-disable-next-line no-console
console.log(process.env.NODE_ENV, `RejectUnauthorized is disabled.`)
}