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

module.require is not a function #83

Open
jasonlimantoro opened this issue Jul 11, 2019 · 4 comments
Open

module.require is not a function #83

jasonlimantoro opened this issue Jul 11, 2019 · 4 comments

Comments

@jasonlimantoro
Copy link

jasonlimantoro commented Jul 11, 2019

Without the plugin, the deployed functions work well.
However, after enabling the plugin, although it's significantly smaller, invoking the API yields the error module.require is not a function, yielding 5xx HTTP status code.

I'm using serverless 4.1.0-rc.1

Any ideas?

@luaneyed
Copy link

luaneyed commented Aug 6, 2019

I got same error.
In my case, it was resolved after matching serverless runtime (which was node 8) with local runtime (node 10).

But I can't say it's just runtime problem with confidence, because executing the result of sls package in local made same error.

@montamal
Copy link

montamal commented Feb 24, 2020

Still a problem even with matching runtime versions, it plays badly with some modules. In my case it was [email protected], reported the issue to them but turns out it was this plugin.

This is worth looking into.

EDIT: Investigating a bit, I found that Browserify doesn't expose module.require. Authors seem to think this opens hacky overrides and won't merge this PR that was open in 2013: browserify/browser-pack#19

@juanpujol
Copy link

Have the same issue with [email protected] the package is huge w/o serverless-plugin-optimize

@gastonrey
Copy link

Hi, any news on this? Anyone got it working at some point? Am getting "errorMessage": "require.resolve is not a function" error and it's probably related.

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

5 participants