Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Require is not a function #21

Open
dafian opened this issue Apr 26, 2017 · 3 comments
Open

Require is not a function #21

dafian opened this issue Apr 26, 2017 · 3 comments

Comments

@dafian
Copy link

dafian commented Apr 26, 2017

Hi,

I'm able to pack the Function App by running funcpack pack ./. Not able to run func run <myfunc> because func is not recognized as a function.
Btw, I've pushed my Function App and at the very first invocation I've got this:
2017-04-26T08:49:38.868 Exception while executing function: Functions.Consumptiochatbot. mscorlib: TypeError: require is not a function at Object.<anonymous> (D:\home\site\wwwroot\.funcpack\index.js:142155:14) at __webpack_require__ (D:\home\site\wwwroot\.funcpack\index.js:21:30) at Object.<anonymous> (D:\home\site\wwwroot\.funcpack\index.js:142714:44) at __webpack_require__ (D:\home\site\wwwroot\.funcpack\index.js:21:30) at Object.module.exports.str (D:\home\site\wwwroot\.funcpack\index.js:71085:18) at __webpack_require__ (D:\home\site\wwwroot\.funcpack\index.js:21:30) at Object.<anonymous> (D:\home\site\wwwroot\.funcpack\index.js:173923:23) at __webpack_require__ (D:\home\site\wwwroot\.funcpack\index.js:21:30) at Object.<anonymous> (D:\home\site\wwwroot\.funcpack\index.js:174680:17) at __webpack_require__ (D:\home\site\wwwroot\.funcpack\index.js:21:30).
At line 142155 I see this: var crypto = require('crypto');.
Is there something that I'm missing?

Thank you

@danielserrao
Copy link

I have a similar where funcpack bundles my code and it changes some of my variables to objects. For example, I'm using the function generate from the node-chartist npm module, which is a function. The error is:

TypeError: generate is not a function in my azure logs.

If I make a console.log(typeof generate) locally I see function, but if I do it in the bundle file in microsoft azure, I will see object.

Any idea why this is happening? Thanks for any help.

@jdelk
Copy link

jdelk commented Feb 11, 2018

I also have this problem with funcpack.

I get this error: TypeError: fetch is not a function in my logs. The package I'm using is https://www.npmjs.com/package/node-fetch

console.log(typeof(fetch)) returns object when bundled.

Hopefully this can be fixed soon, as a cold start for my function is about 25 seconds.

@ErikAndreas
Copy link

Same problem as @jdelk with node-fetch javascript TypeError: fetch is not a function at module.exports.module.exports (D:\home\site\wwwroot\.funcpack\index.js:131255:26)

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

No branches or pull requests

4 participants