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

node-auth0 doesn't play with webpack 3 and 4 #254

Closed
bebbi opened this issue Apr 11, 2018 · 9 comments
Closed

node-auth0 doesn't play with webpack 3 and 4 #254

bebbi opened this issue Apr 11, 2018 · 9 comments

Comments

@bebbi
Copy link

bebbi commented Apr 11, 2018

We have a large monorepo with lots of packages, but no beast to tame quite like node-auth0 (using 2.9.1).
So far, and with a simple default webpack config, we've got two issues that needed their own workarounds. We've tried with webpack 3.10.0 and 4.5.0.

  1. require function is used in a way, in which dependencies cannot be statically extracted
    The cause for this issue is described here. I used the workaround proposed in the same thread:

    plugins: [new webpack.DefinePlugin({ 'global.GENTLY': false })],
    
  2. The other issue is Deepmerge is not a function #239
    The discussion there is continued here with a cause. So, is the conclusion that node-auth0 doesn't work OOTB in either webpack 3 or 4 (see title of linked webpack issue)?

The work-around I used for this issue is

resolve: {
  alias: {
    deepmerge$: path.resolve(
      __dirname,
      '../../node_modules/deepmerge/dist/umd.js'
    )
  }
}

you'd likely leave away the '../../` when not in a monorepo.
Both work but this is of course very brittle and I'd really like to avoid that.

I wonder what are the maintainers experience using this with webpack 3 and 4 versions?

@luisrudge
Copy link
Contributor

The issue here is with deepmerge and webpack as you could read in the issues you mentioned. I'm glad you found the solution, but there's nothing we can do in this library. Thanks for posting the solution, I'm sure it will help anyone having the same issue.

@bebbi
Copy link
Author

bebbi commented Apr 11, 2018

@luisrudge The important thing here is, can you please state whether there is an expectation for auth0 to perform with webpack or not?

If yes, that should be fixed/documented on this tools side.

If not, my expectation would be that at least node-auth0 has a disclaimer on the README saying that it doesn't support AWS/webpack scenarios, because for paying customers that can be a purchase decision.

@luisrudge
Copy link
Contributor

We certainly want node-auth0 to run everywhere, but there's nothing we can do to fix this particular webpack issue. If there's something you think will fix this, please let us know.

@bebbi
Copy link
Author

bebbi commented Apr 11, 2018

Thanks, that's good to know. A couple of ad-hoc suggestions:

  • Document a workaround on the README instead of just closed ticket, so people don't miss it
  • Confirm Deepmerge is not a function #239 is a webpack issue and upvote it there
  • Check whether there's a related node-formidable issue. The linked issue for number 1 mentions quite a simple fix.
  • Both issues are due to the rest-facade import, check for alternatives
  • Check if calling libs could apply a fix/workaround such as using .default if it exists while the webpack issue is open.

@cryptiklemur
Copy link

Webpack support seems to be completely non-functional at the moment. Using Webpack 4.16 with typescript, I'm not able to use the management client at all, without getting "Missing AUthentication", even with the fixes above.

Please re-open this issue, and document on the readme that this isnt working @luisrudge.

@luisrudge
Copy link
Contributor

@aequasi can you build a simple project with node-auth0 and webpack so I can take a look?

@bebbi
Copy link
Author

bebbi commented Apr 12, 2019

I've followed up with the owner of rest-facade on one of the above comments and he immediately published a fixed 1.10.2 with bumped dependencies.
So that might be a great node-auth0 dependency to bump.

@luisrudge Can you help me understand auth0's current stance on webpack to support AWS lambda deployments? We're re-evaluating authN solutions and it would be great to know if auth0 has any practical priorities set around it.

@patrykkrawczyk
Copy link

Is there any update on the first issue? Seems that it still exists :(

@patrykkrawczyk
Copy link

I've created a repository with node-auth0 already bundled for anyone to use in their own project to avoid any issues with formidable and similar errors.
https://github.com/patrykkrawczyk/node-auth0-bundle

Just get the node-auth0-bundle.js file from the dist directory, place it in your project and reference it with import/require statements as such:

import { ManagementClient } from './libs/node-auth0-bundle'
import { AuthenticationClient } from './libs/node-auth0-bundle'

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

No branches or pull requests

4 participants