auth0 / node-auth0

Node.js client library for the Auth0 platform.
MIT License
639 stars 309 forks source link

auth0 library breaks my build because its dependencies requires superagent & superagent-proxy #663

Closed jazarja closed 3 years ago

jazarja commented 3 years ago

Today, I found auth0 breaks my build because it's dependencies (rest-facade) used in auth0/src/management/index.js suddenly move superagent from dependencies to peerDependencies

` 2021-10-01T15:44:00.607Z undefined ERROR Runtime.ImportModuleError: Error: Cannot find module 'superagent-proxy' Require stack:

https://github.com/ngonzalvez/rest-facade/commit/225df62d599617809b4d5386f3a958b423569d27#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519

I think auth0 should add superagent and superagent-proxy as its dependencies to avoid it breaking end user app build.

adamjmcgrath commented 3 years ago

Hi @jazarja - thanks for raising this

Hopefully we can resolve this in rest-facade here https://github.com/ngonzalvez/rest-facade/pull/61

Will keep this open until it's resolved

daltonwallace commented 3 years ago

We're also starting to see this issue in our project

frederikprijck commented 3 years ago

They have released 1.16.2, which should solve this problem.

igor-yamshchykov commented 3 years ago

Just in case anyone needs that as temporary solution, locking rest-facade to 1.13.0 works fine

frederikprijck commented 3 years ago

Locking might work, but they also released a fix before you made this comment. So I would argue verifying if it's solved for you before downgrade might be a good idea.

jodiedoubleday commented 3 years ago

so is the fix here to add rest-facade as a dependency? or wait for an update to Auth0?

Edit: just seen this PR - https://github.com/auth0/node-auth0/pull/667 so I'll wait for Auth0 update

jodiedoubleday commented 3 years ago

This still seems to be a problem, Is there any update on when or how this can be resolved?

frederikprijck commented 3 years ago

I believe you can install the dependency if u want, but let me give u some context:

However, as we do not use the proxy, we believe we should not add it to our dependencies. Either rest-facade should add it again, or you should add it. But I believe we should not ship a big dependency that we don't use because our dependency broke us.

So I would open an issue with their repository to discuss the issue on how to work around this in build systems. I believe they were a little bit optimistic removing it as a dependency and not shipping a major version, as now they broke a lot of people.

jodiedoubleday commented 3 years ago

thank you @frederikprijck that's a great explanation. I'll look at raising a ticket with rest-facade

Edit: Looks like one has been created - https://github.com/ngonzalvez/rest-facade/issues/63 Thanks for your help!

gabriel-iulian commented 2 years ago

installing rest-facade version 1.13.0 inside module with auth0 fixed it for me thanks to the guy who mentioned the working version

naishe commented 1 year ago

superagent-proxy is big and only used when u set proxy to true.

I use barebones NextJS 13, and this is what I use

  const auth0ManagementClient = new ManagementClient({
    clientId: env.AUTH0_MANAGEMENT_CLIENT_ID,
    clientSecret: env.AUTH0_MANAGEMENT_CLIENT_SECRET,
    domain: env.AUTH0_MANAGEMENT_DOMAIN,
  });
    "auth0": "^3.4.0",

I face the same issue. @frederikprijck -- where do you turn off proxy? This is a new project, and I don't want to incorporate a dependency which is deprecated and has 50 dependencies!

❯ p add rest-facade@1.13.0 
 WARN  deprecated superagent@5.3.1: Please upgrade to v7.0.2+ of superagent.  We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing.  See the releases tab for more information at <https://github.com/visionmedia/superagent/releases>.
 WARN  deprecated formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
Packages: +50
++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 729, reused 721, downloaded 0, added 0, done

dependencies:
+ rest-facade 1.13.0 (1.16.4 is available)

Any resolution?