jbreckmckye / electron-auth0-login

Helper widget for Auth0 authentication in Electron desktop apps
MIT License
28 stars 19 forks source link

Uncaught TypeError: Path must be a string. Received undefined #9

Closed harishajdarevic closed 4 years ago

harishajdarevic commented 4 years ago

Hello,

Here is mine setup:

In angular component I did the following:

import { ElectronAuth0Login } from 'electron-auth0-login';

  constructor(private router: Router, private store: Store<IAppState>) {
    new ElectronAuth0Login({
      // Get these from your Auth0 application console
      auth0Audience: 'https://myaudience,
      auth0ClientId: 'myclientid',
      auth0Domain: 'mysite.auth0.com',
      auth0Scopes: 'openid profile read:current_user'
    });
  }

And I am getting error:

Path must be a string. Received undefined
    at assertPath (path.js:28)
    at dirname (path.js:1364)
    at Object.exports.findPackage (index.js:209)
    at Object.exports.register (index.js:295)
    at Object.<anonymous> (index.js:19)
    at Object.module.exports (index.js:152)
    at __webpack_require__ (bootstrap 53044806b26765e6337a:49)
    at Object.<anonymous> (index.ts:1)
    at __webpack_require__ (bootstrap 53044806b26765e6337a:49)
    at Object.<anonymous> (index.ts:1)
    at __webpack_require__ (bootstrap 53044806b26765e6337a:49)
    at Object.<anonymous> (app.routes.ts:2)
    at __webpack_require__ (bootstrap 53044806b26765e6337a:49)
    at Object.<anonymous> (app.component.ts:19)
    at __webpack_require__ (bootstrap 53044806b26765e6337a:49)
    at Object.<anonymous> (index.ts:1)
    at __webpack_require__ (bootstrap 53044806b26765e6337a:49)
    at Object.<anonymous> (main.browser.ts:1)
    at __webpack_require__ (bootstrap 53044806b26765e6337a:49)
    at Object.<anonymous> (external "require('zlib')":1)
    at __webpack_require__ (bootstrap 53044806b26765e6337a:49)
    at bootstrap 53044806b26765e6337a:147
    at main.bundle.js:152
jbreckmckye commented 4 years ago

Are you sure this is caused by the auth0 login package? It looks like it's choking whilst importing zlib, which as far as I know isn't part of this package's dependency tree.

jbreckmckye commented 4 years ago

Going to close this for inactivity - let me know if you still have issues

smeevil commented 4 years ago

Hi,

I'm running into the exact same error, in my case originating from var electron_auth0_login_1 = __importDefault(__webpack_require__(/*! electron-auth0-login */ "./node_modules/electron-auth0-login/dist/index.js"));

It seems to have something to do with the codependency package at Object.module.exports../node_modules/codependency/index.js.exports.findPackage (/Users/smeevil/dev/electron/devnote/.webpack/main/index.js:10810:13) at Object.module.exports../node_modules/codependency/index.js.exports.register (/Users/smeevil/dev/electron/devnote/.webpack/main/index.js:10896:20)

as far as I can trace it back the root cause seems to be line 7 in index.ts: const requirePeer = codependency.register(module);

jbreckmckye commented 4 years ago

I could try a different version of codependency or possibly remove it entirely. If I remove it, though, it will mean that anyone who installs this package will end up installing node-keytar whether or not their project uses it. This is preferable to the project not working though.

jbreckmckye commented 4 years ago

Still not really sure why webpack is choking on the codependency call though.

jbreckmckye commented 4 years ago

I'm not really in a position to fix this right now but I'll gladly accept pull requests

jbreckmckye commented 4 years ago

I'm going to close this due to inactivity. If you have had any further problems, comment here and I will reopen the issue. Thanks.