-
Notifications
You must be signed in to change notification settings - Fork 310
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
Deepmerge is not a function #239
Comments
does it work in your machine (not in lambda)? |
It's hard to run locally, but using a tool called sam local it spins up a docker container with a similar execution environment to that of Lambda. Sam local output:
AWS Lambda output:
The call that triggers this error is constructing a new instance of the ManagementClient:
|
I think I am falling foul of this issue - webpack/webpack#5756 which is probably just a bug with the deepmerge package 👎 |
It is not a bug in deepmerge. See TehShrike/deepmerge#92 (comment) + TehShrike/deepmerge#87 (comment) |
Do you have a stack trace? We don't use deepmerge directly, so it's probably a dependency |
The stack trace references my webpack bundled code so it's not massively helpful, but it does have the class names in so I'll add it below. The library is coming in from the dependency on
|
This looks like a pretty standard require to me, but maybe the rest-facade owner has more info about it. I'll close it since it's not related with this project. |
Maybe, but the end result is that I can't use this library in my application. Which is shame as we are currently storing all our user data in Auth0. |
You absolutely can use it. The SDK itself works as expected. What you're having is an environment issue, not an SDK issue. |
Unfortunately, I don't know enough about aws lambda to help you fix this issue :( |
Lambda aside, I think building the webpack bundle is where it's tripping up. It's a very basic webpack build that creates a bundle targeting commonjs2. I've tried various ways of requiring the library e.g. |
I'd just like to add my support to Pacey. I'm having the same issue, but on a normal Node 7 environment –– and I'm not using rest-facade. My stack trace looks like this:
Is it possible that both |
as with any npm package, everything is possible 😝 can you reproduce with only node-auth0? Or this only happens in your app, which you have some other dependencies? |
Apparently most of the people reporting issues in TehShrike/deepmerge#87 were using TypeScript - is that the case with you folks? |
My app has loads of dependencies @luisrudge ! 😁 . Producing a minimal test case is going to be tricky here – but suffice to say that it only happens when I call methods of node-auth0. Very confusing. @TehShrike I'm not using TypeScript. But I am using babel transformed ES6 code. |
Like I asked in that issue over on deepmerge, if anyone is able to put together a minimal reproduction repo with Webpack, we can take it to the Webpack devs for them to work on. I don't use Webpack and am not motivated to learn, so I'm not going to be the one putting it together :-x |
Fair enough @TehShrike . I guess my main reluctance to do that is I don't know where the conflict is coming in. I've got a big project with dozens of dependencies – and it's reasonably likely that deepmerge isn't even in the first level of those dependencies, so it's going to be a massive trial and error job, not only removing dependencies from package.json, but also from the codebase. My gut feeling is that it's not a problem with deepmerge itself, but more likely some incompatibility between two separate imports of the package. Having said that, I've just reverted my app to a commit from about six weeks ago and it works fine, so that means that the issue is either in a version bump or an additional package in the intervening time. |
Hopefully seeing where it's used will make it easier to set up a reproduction. |
Ooh I didn't know that nugget. Handy. So, here's some odd stuff. When I do that, I get this:
So, a dependency on MUI, nothing to do with Auth0. However, if I do
More digging tomorrow... |
My bad, the |
Aha, binning my
Is it possible that these two versions of deepmerge are somehow conflicting? I can see how in Pacey's case he'd end up with something similar if he was using a newer version of I'll do some digging tomorrow to understand how these two packages are importing deepmerge. |
I've sorted my issue! For me, it turns out that it was a configuration error in my part in my webpack config. I don't totally understand the ins and outs of this, but it looks like Webpack has the concepts of 'externals', which says "look don't transpile the stuff that you find that matches this pattern". The usual use case is for the In my case, I had moved where my new ExternalsPlugin({
type: "commonjs",
include: path.join(__dirname, "../node_modules/"),
}), Now, I don't really know why this only reared its head now. It could be that I just wasn't testing it properly on the server (which is the one that uses this path configuration), or it could be that something changed in one of the dependent packages that affected how imports worked. The timing coinciding with @pacey makes me suspicious! I suppose it could be related to the fact that this ExternalsPlugin is only set up to 'ignore' commonjs modules – and perhaps something to do with the removal of the |
That's interesting. If that's related, I'll bet it had more to do with deepmerge adding a ESM build exposed via |
Ah ok and that happened somewhere between 1.5.2->2.0.1 ? My guess is that this isn't a 'new' issue and reared its head when the issue over on webpack was posted in October. |
No, 1.5.2 had |
The |
Would like to also voice my concern here. Exact issue us happening on a Netlify app using Functions (AWS Lambda) and trying to use the auth0 management API client. No real solution seems to be given and the issue is closed? Has anyone found any workarounds? |
It's a bug in Webpack: webpack/webpack#6584 |
This workaround might get you by: https://github.com/KyleAMathews/deepmerge#webpack-bug |
I added the following to my webpack config as an alias to mitigate
|
|
@TehShrike |
Version: 2.9.1
Node version: 6.10
Environment: AWS Lambda
I'm having trouble with a transitive dependency that this project is using called deepmerge, via rest-facade. At runtime I get an error
deepmerge is not a function
.The text was updated successfully, but these errors were encountered: