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

Crashes when required file is not a module (like requiring a plain js) #82

Open
pursual opened this issue Aug 3, 2023 · 2 comments
Open

Comments

@pursual
Copy link

pursual commented Aug 3, 2023

/serverless-plugin-include-dependencies/get-dependency-list.js:82:66
const pathToModule = resolve.sync(path.join(moduleName, 'package.json'), { basedir }); throws an error that is uncaught, because moduleName is null:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
@pursual
Copy link
Author

pursual commented Aug 3, 2023

This basically makes it impossible to use when including custom code from a shared layer.

@ianbale
Copy link

ianbale commented Oct 12, 2023

I've not got the time to do a fix and PR, but if anyone wants to do so, or just fix your copy for now, you can do by by editing get-dependency-list.js.

Find the two calls to handle() and wrap that in an IF statement: if (dependency.substring(0,5) !== "/opt/")

Very rough and ready, bit it will get you going for now.

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

2 participants