Skip to content

https module doesn't seems to be working properly #137

Description

@bsumer-wyn

Hi, I have shimmed https and https modules, and when I try to create a new httpsAgent, it returns an empty object. I wonder what I am doing wrong. What I am trying to do is basically passing my ssl certificate and private key to the httpsAgent so I can be authenticated in the server without using a VPN client. Help would be greatly appreciated. Thanks

const httpsAgent = new https.Agent({
  cert: cert2,
  key: key2,
  rejectUnauthorized: false,
});
console.log("AGENT", httpsAgent);

This is my dependencies:


  "react-native": {
    "https": "https-browserify",
    "http": "@tradle/react-native-http"
  },
  "browser": {
    "https": "https-browserify",
    "http": "@tradle/react-native-http"
  }

My shim file:

if (typeof __dirname === 'undefined') global.__dirname = '/';
if (typeof __filename === 'undefined') global.__filename = '';
if (typeof process === 'undefined') {
  global.process = require('process');
} else {
  const bProcess = require('process');
  for (var p in bProcess) {
    if (!(p in process)) {
      process[p] = bProcess[p];
    }
  }
}

process.browser = false;
if (typeof Buffer === 'undefined') global.Buffer = require('buffer').Buffer;

// global.location = global.location || { port: 80 }
const isDev = typeof __DEV__ === 'boolean' && __DEV__;
process.env.NODE_ENV = isDev ? 'development' : 'production';
if (typeof localStorage !== 'undefined') {
  localStorage.debug = isDev ? '*' : '';
}

// If using the crypto shim, uncomment the following line to ensure
// crypto is loaded first, so it can populate global.crypto
// require('crypto')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions