Local Environment

SSL

Error: unable to get local issuer certificate:

法一:

async apiLoader(endpoint, forceUpdate = false) {
    try {
      const token = await this.getToken();
      const { data } = await axios.get(endpoint, {
        headers: {
          'X-SAP-LogonToken': token,
          Accept: 'application/json',
        },
        // httpsAgent
        httpsAgent: new https.Agent({ keepAlive: true, rejectUnauthorized: false }),
        baseURL: `${sails.config.custom.sap.endpoint}/biprws`,
        forceUpdate,
      });
      return data;
    } catch (error) {
      sails.log(`Api error: ${endpoint} ${error}`);
      if (error.message.includes('401')) {
        this.getNewToken();
      }
      throw error;
    }
  },

法二:

// local.js
module.exports = {
  ssl: {
    disableCertificateValidation: true,
  },
}

法三:

npm config set strict-ssl false
Article
Tagcloud
DVA Java Express Architecture Azure CI/CD database ML AWS ETL nest sql AntV Next Deep Learning Flutter TypeScript Angular DevTools Microsoft egg Tableau SAP Token Regexp Unit test Nginx nodeJS sails wechat Jmeter HTML2Canvas Swift Jenkins JS event GTM Algorithm Echarts React-Admin Rest React hook Flux Redux ES6 Route Component Ref AJAX Form JSX Virtual Dom Javascript CSS design pattern