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

Feature/allow custom runtime #675

Merged
merged 3 commits into from
Dec 31, 2020
Merged

Feature/allow custom runtime #675

merged 3 commits into from
Dec 31, 2020

Conversation

MatteoGioioso
Copy link
Contributor

@MatteoGioioso MatteoGioioso commented Dec 14, 2020

What did you implement:

Closes #664

Allow custom runtime if Nodejs based.

How did you implement it:

Those are the proposed changes:

We add an additional property to allow a custom runtime only if the user sets this to true

  exampleFunction:
    memorySize: 1024
    timeout: 30
    handler: services/myService/handler.default
    runtime: provided
    allowCustomRuntime: true

And then add another check:

if (runtime === 'provided' && loadedFunc.allowCustomRuntime) {
        const entry = getEntryForFunction.call(this, functions[index], loadedFunc);
        _.merge(entries, entry);
}

How can we verify it:

You can check this repository https://github.com/MatteoGioioso/serverless-webpack-bug

Without this feature

  • Input: specify runtime: provided and use the latest version of serverless-webpack
  • Output: serverless-webpack will skip anything that is not a nodejs runtime:
    if (runtime.match(/node/)) {

    Therefore it will package the entire project. You can inspect the .serverless folder after the packaging has completed

With this feature

I have added a test as well to check this condition and updated the documentation.

=============================== Coverage summary ===============================
Statements   : 96.34% ( 736/764 )
Branches     : 86.49% ( 320/370 )
Functions    : 95.31% ( 183/192 )
Lines        : 96.42% ( 728/755 )

Todos:

  • Write tests
  • Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config / commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

the user can now specify runtime: provided, previously this was not possible
and nodejs custom runtime function could not be packaged with the plugin
add custom runtime documentation
@j0k3r j0k3r added this to the 5.4.0 milestone Dec 14, 2020
Copy link
Member

@j0k3r j0k3r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks ok, thanks @MatteoGioioso!

@MatteoGioioso
Copy link
Contributor Author

@j0k3r cool thanks, I will wait for the release.

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 this pull request may close these issues.

Packaging bug when using nodejs based custom runtime
2 participants