Can't resolve 'superagent-proxy'
naishe opened this issue · 7 comments
Checklist
- I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Description
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",
It's suggested here: #663 (comment) to install a deprecated dependency. 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?
Reproduction
In nextJS route try using this code
export async function createUser(email: string) {
const auth0ManagementClient = new ManagementClient({
clientId: env.AUTH0_MANAGEMENT_CLIENT_ID,
clientSecret: env.AUTH0_MANAGEMENT_CLIENT_SECRET,
domain: env.AUTH0_MANAGEMENT_DOMAIN
});
const password = generatePassword.generate({
length: 10,
numbers: true,
symbols: true,
uppercase: true,
strict: true,
});
return auth0ManagementClient.createUser({
email,
connection: "Username-Password-Authentication",
password,
});
}
Additional context
No response
node-auth0 version
^3.4.0
Node.js version
v20.2.0
Thanks for reaching out.
Can you try uninstalling that version of rest-facade, but stick with what our SDK provides (which should be ^1.16.3 for rest-facade, resolving to the latest version (1.16.4))?
Would it be resolved if you then npm i superagent-proxy
, which should install v7, the non-deprecated version.
Let me know if that wouldn't work.
Thanks for the reply. Installing the latest version of rest-facade
and then installing the latest superagent-proxy
does seem work, but the logs are filled with ugly warning messages but I really don't want to add formidable
and/or coffee-script
as dependency. :(
The superagent-proxy's latest version is 3.0.0
at the moment.
This is what polluting the log files now.
warn - ./node_modules/.pnpm/formidable@2.1.2/node_modules/formidable/src/Formidable.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
./node_modules/.pnpm/formidable@2.1.2/node_modules/formidable/src/Formidable.js
./node_modules/.pnpm/formidable@2.1.2/node_modules/formidable/src/index.js
./node_modules/.pnpm/superagent@7.1.5/node_modules/superagent/lib/node/index.js
./node_modules/.pnpm/rest-facade@1.16.4_superagent-proxy@3.0.0/node_modules/rest-facade/src/Client.js
./node_modules/.pnpm/rest-facade@1.16.4_superagent-proxy@3.0.0/node_modules/rest-facade/src/index.js
./node_modules/.pnpm/auth0@3.4.0_superagent-proxy@3.0.0/node_modules/auth0/src/management/index.js
./node_modules/.pnpm/auth0@3.4.0_superagent-proxy@3.0.0/node_modules/auth0/src/index.js
./[-- snip --]/auth0Utils.ts
./app/api/[-- snip --]/route.ts
./node_modules/.pnpm/vm2@3.9.19/node_modules/vm2/lib/compiler.js
Module not found: Can't resolve 'coffee-script' in '/Users/[--snip--]/node_modules/.pnpm/vm2@3.9.19/node_modules/vm2/lib'
Import trace for requested module:
./node_modules/.pnpm/vm2@3.9.19/node_modules/vm2/lib/compiler.js
./node_modules/.pnpm/vm2@3.9.19/node_modules/vm2/lib/script.js
./node_modules/.pnpm/vm2@3.9.19/node_modules/vm2/lib/main.js
./node_modules/.pnpm/vm2@3.9.19/node_modules/vm2/index.js
./node_modules/.pnpm/degenerator@3.0.4/node_modules/degenerator/dist/src/index.js
./node_modules/.pnpm/pac-resolver@5.0.1/node_modules/pac-resolver/dist/index.js
./node_modules/.pnpm/pac-proxy-agent@5.0.0/node_modules/pac-proxy-agent/dist/agent.js
./node_modules/.pnpm/pac-proxy-agent@5.0.0/node_modules/pac-proxy-agent/dist/index.js
./node_modules/.pnpm/proxy-agent@5.0.0/node_modules/proxy-agent/index.js
./node_modules/.pnpm/superagent-proxy@3.0.0_superagent@7.1.5/node_modules/superagent-proxy/index.js
./node_modules/.pnpm/rest-facade@1.16.4_superagent-proxy@3.0.0/node_modules/rest-facade/src/Client.js
./node_modules/.pnpm/rest-facade@1.16.4_superagent-proxy@3.0.0/node_modules/rest-facade/src/index.js
./node_modules/.pnpm/auth0@3.4.0_superagent-proxy@3.0.0/node_modules/auth0/src/management/index.js
./node_modules/.pnpm/auth0@3.4.0_superagent-proxy@3.0.0/node_modules/auth0/src/index.js
./[-- snip --]/auth0Utils.ts
./app/api/[-- snip --]/route.ts
./node_modules/.pnpm/vm2@3.9.19/node_modules/vm2/lib/resolver-compat.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
./node_modules/.pnpm/vm2@3.9.19/node_modules/vm2/lib/resolver-compat.js
./node_modules/.pnpm/vm2@3.9.19/node_modules/vm2/lib/main.js
./node_modules/.pnpm/vm2@3.9.19/node_modules/vm2/index.js
./node_modules/.pnpm/degenerator@3.0.4/node_modules/degenerator/dist/src/index.js
./node_modules/.pnpm/pac-resolver@5.0.1/node_modules/pac-resolver/dist/index.js
./node_modules/.pnpm/pac-proxy-agent@5.0.0/node_modules/pac-proxy-agent/dist/agent.js
./node_modules/.pnpm/pac-proxy-agent@5.0.0/node_modules/pac-proxy-agent/dist/index.js
./node_modules/.pnpm/proxy-agent@5.0.0/node_modules/proxy-agent/index.js
./node_modules/.pnpm/superagent-proxy@3.0.0_superagent@7.1.5/node_modules/superagent-proxy/index.js
./node_modules/.pnpm/rest-facade@1.16.4_superagent-proxy@3.0.0/node_modules/rest-facade/src/Client.js
./node_modules/.pnpm/rest-facade@1.16.4_superagent-proxy@3.0.0/node_modules/rest-facade/src/index.js
./node_modules/.pnpm/auth0@3.4.0_superagent-proxy@3.0.0/node_modules/auth0/src/management/index.js
./node_modules/.pnpm/auth0@3.4.0_superagent-proxy@3.0.0/node_modules/auth0/src/index.js
./[-- snip --]/auth0Utils.ts
./app/api/[-- snip --]/route.ts
Installing the latest version of rest-facade and then installing the latest superagent-proxy does seem work
Installing our SDK in a new project should bring in the latest version of rest-facade. Maybe you have an older version because of the manual npm install
you did ?
I understand what's been called our, but that's not part of our SDK directly, but a consequence of using rest-facade
.
We do have a beta version of our SDK available that no longer uses rest-facade
, or it's underlying superagent-proxy
, so we are aware of the issues and have been actively working on replacing it.
Feel free to try it out and provide feedback, and know that any workaround you have to do now, is temporary while we work towards GA.
I am excited to learn that this pain is temporary. 👍
I performed a clean install but the formidable and coffee-script warnings stay. The user creation works. 🤞 I am putting in the staging. Worst case, I will write a couple of simple fetch
calls to Auth0 endpoints to get my job done; but I am hopeful.
Thanks.
@frederikprijck -- I have tested beta. It's better but not without flaws. One thing that I noticed that it uses an older node-fetch
library. The current version is 3.3.1
while auth0@beta
seems to be using 2.6.11
. However, my bigger concern is this warning message in beta
warn - ./node_modules/.pnpm/node-fetch@2.6.11/node_modules/node-fetch/lib/index.js
Module not found: Can't resolve 'encoding' in '/Users/[--snip--]/node_modules/.pnpm/node-fetch@2.6.11/node_modules/node-fetch/lib'
Import trace for requested module:
./node_modules/.pnpm/node-fetch@2.6.11/node_modules/node-fetch/lib/index.js
./node_modules/.pnpm/auth0@4.0.0-beta.3/node_modules/auth0/dist/cjs/lib/runtime.js
./node_modules/.pnpm/auth0@4.0.0-beta.3/node_modules/auth0/dist/cjs/auth/database.js
./node_modules/.pnpm/auth0@4.0.0-beta.3/node_modules/auth0/dist/cjs/auth/index.js
./node_modules/.pnpm/auth0@4.0.0-beta.3/node_modules/auth0/dist/cjs/index.js
./[-- snip --]/auth0Utils.ts
#798 (comment) may be helpful for the issue, if you have to use v3, as v4 beta requires >= Nodejs16