Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth0 cli dependencies error #874

Open
6 tasks done
Gentracker1 opened this issue Dec 12, 2023 · 12 comments
Open
6 tasks done

Auth0 cli dependencies error #874

Gentracker1 opened this issue Dec 12, 2023 · 12 comments
Labels

Comments

@Gentracker1
Copy link

Gentracker1 commented Dec 12, 2023

Checklist

  • I have looked into the README and have not found a suitable solution or answer.
  • I have looked into the 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 upgraded to the latest version of this tool and the issue still persists.
  • 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

Hello,
We are using auth0-cli as a node-module to export the data. We have tried with [7.20.0][7.19.0]....[7.11.0] versions, but same error.

Environment
WSL on windows, Ubuntu-22.04
Node v18.16.0
Using Typescript Version 4.9.5
Using Auth0-cli in AWS Lambda (import { dump } from 'auth0-deploy-cli';)

Package.json
"auth0": "4.0.1",
"auth0-deploy-cli": "7.20.0"

Lambda code
import {
Connection,
ManagementClient,
PostUsersExportsRequest,
GetOrganizationMemberRoles200ResponseOneOfInner,
} from "auth0";
import { dump } from 'auth0-deploy-cli';

//start dump clients
dump({
output_folder: '/tmp/auth0-config/export/directory"',
format: 'directory',
config: {
AUTH0_DOMAIN: secrets.domain,
AUTH0_CLIENT_ID: secrets.client_id,
AUTH0_CLIENT_SECRET: secrets.client_secret,
},
})
.then(() => {
console.log('Auth0 configuration export successful');
})
.catch((err) => {
console.log('Error during Auth0 configuration export:', err);
});
//end dump

Steps:

npm install

npm run build
"build": npm run functions:build,
"functions:build": "tsc -p functions",

https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda_nodejs.NodejsFunction.html
Node.js Lambda function bundled using esbuild.

suhailt@GTKNZ072:~/Project/platform-auth0$ npm run build

[email protected] build
npm run functions:build

[email protected] functions:build
tsc -p functions

node_modules/promise-pool-executor/index.d.ts:5:31 - error TS2305: Module '"promise-batcher"' has no exported member 'BatcherToken'.

5 export { BATCHER_RETRY_TOKEN, BatcherToken, BatchingResult } from "promise-batcher";
~~~~~~~~~~~~

Found 1 error in node_modules/promise-pool-executor/index.d.ts:5
`

Expectation

Able to deploy the lambda with the auth0-cli.

Reproduction

With node Node v18.16.0
Using Typescript Version 4.9.5
Use the latest 7.20.0

Deploy the AWS lambda
npx cdk deploy

Deploy CLI version

7.20.0

Node version

v18.16.0

@m3talsmith
Copy link

@Gentracker1 can you reproduce this locally? Or only on lambda?

If only on lambda, are you using the default image for AWS Node? If not, is it an image we can use to reproduce?

I did write a small test to try it locally and couldn't reproduce the error. I'm trying to get as close to your setup as possible. The lambda environment is my main unknown. I'm happy to dig in more if you could get me that info.

@Gentracker1
Copy link
Author

Gentracker1 commented Dec 14, 2023

auth0-720

@Gentracker1
Copy link
Author

Updated with the more info and updated the auth0/auth0-cli to the latest version. The error with the latest version is at npm run build.

We are using the WSL Ubuntu with AWS CDK,

@Gentracker1
Copy link
Author

@m3talsmith I have updated the error desc, we are using the latest auth0-cli.
Thanks

@m3talsmith
Copy link

@Gentracker1 I was able to reproduce the promise-batcher error. Will have a work around for you soon.

@m3talsmith
Copy link

@Gentracker1 what happens if you add this to your dependencies:

"promise-batcher": "1.0.1"

@Gentracker1
Copy link
Author

Thanks @m3talsmith .
After installing promise-batcher, I was able to build and deploy the lambda.
On executing the lambda, it gives the below error.
{ "errorType": "TypeError", "errorMessage": "hexoid is not a function", "trace": [ "TypeError: hexoid is not a function", " at node_modules/formidable/src/Formidable.js (/var/task/index.js:68166:20)", " at __require (/var/task/index.js:12:50)", " at node_modules/formidable/src/index.js (/var/task/index.js:69025:22)", " at __require (/var/task/index.js:12:50)", " at node_modules/superagent/lib/node/index.js (/var/task/index.js:73799:22)", " at __require (/var/task/index.js:12:50)", " at node_modules/rest-facade/src/Client.js (/var/task/index.js:116198:19)", " at __require (/var/task/index.js:12:50)", " at node_modules/rest-facade/src/index.js (/var/task/index.js:116454:15)", " at __require (/var/task/index.js:12:50)" ] }

@matthewhgentrack
Copy link

Found a similar error for "hexoid" is not a function here: auth0/node-auth0#798
Suggestions for a fix there seem to relate to webpack. Not sure how to resolve for AWS CDK/NodeJsFunction which is bundling via esbuild.

@matthewhgentrack
Copy link

Overriding the superagent version for rest-facade in package.json seems to workaround the problem.

"overrides": {
    "rest-facade": {
      "superagent": "6.0.0"
    }
  }

Not an ideal solution to override dependencies though.

@m3talsmith
Copy link

Tracking down hexoid and superagent errors now @Gentracker1 and @matthewhgentrack

@m3talsmith
Copy link

This definitely comes down to transitive dependencies of node-auth. Specifically, it comes down to formidable via superagent as @matthewhgentrack points out. A workaround seems to be to downgrade superagent or save the latest formidable to your npm packages.

@MrOctopus
Copy link

The fix is simple: Don't add add an old promise-batcher version to your direct dependencies. Do an override of the peer dependency itself:
"overrides": { "promise-pool-executor": { "promise-batcher": "1.0.2" } }
To avoid the hexoid issue, just make sure to use the newest auth0 3.* version (v3.7.2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants