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 on node v12 #62

Closed
jaydp17 opened this issue May 6, 2019 · 4 comments · Fixed by #63
Closed

Crashes on node v12 #62

jaydp17 opened this issue May 6, 2019 · 4 comments · Fixed by #63

Comments

@jaydp17
Copy link
Contributor

jaydp17 commented May 6, 2019

In the below code we check for error.message to end with the customPath.

if (e.code !== 'MODULE_NOT_FOUND' || !e.message.endsWith(`'${customPath}'`)) {

But starting with node.js v12, for MODULE_NOT_FOUND errors the error message also includes the require stack (nodejs/node#25690), which breaks the expected behavior that we want.

// e.message before node v12
"Cannot find module '/<serviceDirectory>/stacks-map.js'"
// e.message in node v12
"Cannot find module '/<serviceDirectory>/stacks-map.js'
Require stack:
- /<serviceDirectory>/node_modules/serverless-plugin-split-stacks/lib/migration-strategy/custom.js
- /<serviceDirectory>/node_modules/serverless-plugin-split-stacks/lib/migrate-new-resources.js
- /<serviceDirectory>/node_modules/serverless-plugin-split-stacks/split-stacks.js
- /<serviceDirectory>/node_modules/serverless/lib/classes/PluginManager.js
- /<serviceDirectory>/node_modules/serverless/lib/Serverless.js
- /<serviceDirectory>/node_modules/serverless/lib/utils/autocomplete.js
- /<serviceDirectory>/node_modules/serverless/bin/serverless"
@johndww
Copy link

johndww commented May 16, 2019

@dougmoscrop Is it possible to cut a release for this? I can't figure out how to include the fix in my deployment in package.json.

@dougmoscrop
Copy link
Owner

Whoops! I will publish a release now.

For future reference if you're in a pinch, you can use a github reference as a version in package.json:

"serverless-plugin-split-stacks": "github:dougmoscrop/serverless-plugin-split-stacks#tag-or-sha"

@johndww
Copy link

johndww commented May 16, 2019

@dougmoscrop thanks very much! Good to know for the future.

@dougmoscrop
Copy link
Owner

Published 1.7.3 with the fix

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

Successfully merging a pull request may close this issue.

3 participants