-
Notifications
You must be signed in to change notification settings - Fork 116
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
Function invocation failed: TypeError: n is not a function #64
Comments
Ok, I played around with this some more and actually if I run serve and then just copy paste my JS into the js file that's being served, it works fine. It seems like this might be a problem with the way netlify-lambda is minifying my script |
I'm so getting the same error, but due to other reasons. For me it happens when I require the auth0-node Management Client code. Is there a way to turn off the js minification so we can debug these issues better? |
FYI, I was able to disable the uglification of the functions locally by passing in my own webpack config like so: Create a webpack overrides file (mine lives in
Start the local server by passing in my local config
I can see the non-uglified version of the code now. For me, the error is:
And the corresponding line of code:
Looking through the rest of the generated file, it seems that some parts of the code are not being processed by babel, so there are regular Gotta look into the |
A bit more context on my specific issue. Noticed that
UPDATE These are littered all over the
https://github.com/felixge/node-formidable/blob/master/lib/incoming_form.js#L1 UPDATE 2 Found this great thread that has a workaround: my new webpack.functions.js override config looks like this now:
|
Awesome, I think this will help me troubleshoot as well! Thanks for sharing |
hey both, sorry for the delayed response and thanks for sharing. if theres anything that you can contribute upstream to babel too, that would probably be good as minification shouldnt ever cause bugs like this :( but i am glad you figured it out. |
Thanks this is happening with |
@dominictobias we are releasing something this week which may help with this. looking forward to see if it solves your issue. |
I'm getting the same error as above. When I fire up my lambda functions to listen locally I get a warning:
Then when I triggered my function get the same error as OP
I tried adding the webpack plugin like @i8ramin mentioned. I'm using Gatsby so added to gatsby-node.js file like so:
But it did not help. Still getting both of the above errors. Is there a better way to add the above webpack config into Gatsby or fix these errors? |
@connor11528 check out Netlify Dev! https://www.youtube.com/watch?v=RL_gtVZ_79Q As far as I can tell it either makes this repo obsolete or much less necessary. |
@TylerBarnes oh gnar will have to look into it. Thanks! |
@connor11528 do you solved that? I'm with the same problem here and I'm can't figure out how to solve this... |
@castilh0s give Netlify Dev a try. thats the solution i suggested further up. gonna lock this for now, pls open new issue with repro details if you need to pursue further |
Hi there,
I'm attempting to use a lambda function to use the node wpapi library
https://github.com/WP-API/node-wpapi
For some reason when I try to instantiate a new instance of their WPAPI class I get the error
Function invocation failed: TypeError: n is not a function
I don't believe this is a problem with netlify-lambda but I'm wondering if someone could give me some guidance on debugging this. Is there something I need to add to my config to make it run? Or is there some way for me to figure out why n is not a function? The error comes from the minified code so it's hard to understand what's happening
The text was updated successfully, but these errors were encountered: