Navigation Menu

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

Add support for multiple runtimes in service #530

Closed
wants to merge 5 commits into from
Closed

Add support for multiple runtimes in service #530

wants to merge 5 commits into from

Conversation

brendanhonea
Copy link

@brendanhonea brendanhonea commented Aug 7, 2019

What did you implement:

Added support for projects that have lambdas running on multiple runtimes. In our case, we needed some java lambdas to run in the same project as our typescript lambdas and the plugin was trying to bundle all runtimes.

How did you implement it:

In validate.js, added a check for runtime.startswith('node') so that the plugin only tries to package node lambdas.

How can we verify it:

Create a serverless project that includes node lambdas, and lambdas from other supported runtimes (java, python, etc). Make sure that package.invidually is true. Master branch will try to package the other runtimes with webpack and will cause errors when invoking the lambdas. This fork will package only node lambdas with the plugin

Todos:

  • Write tests
  • Write documentation (None needed)
  • 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

@ineffyble
Copy link

Any updates on this? It looks like an alternative to #256

@somq
Copy link

somq commented May 6, 2020

Hi @brendanhonea, thanks for the PR.
Would be nice to also add a skipCompile like flag here in the before:invoke:local:invoke hook to allow sls invoke local to work with Python lambdas

      'before:invoke:local:invoke': () =>
          ...

            const functionDef = this.serverless.service.getFunction(this.options.function);
            this.isFuncNode = _.startsWith(functionDef.runtime, 'node')

            return this.serverless.pluginManager.spawn('webpack:validate');
          })
          .then(() => (this.skipCompile || !this.isFuncNode ? BbPromise.resolve() : this.serverless.pluginManager.spawn('webpack:compile')))
          .then(() => (this.isFuncNode ? this.prepareLocalInvoke() : BbPromise.resolve())),

Could you eventually add this to your fork?

@miguel-a-calles-mba miguel-a-calles-mba added this to the 5.3.3 milestone May 13, 2020
@miguel-a-calles-mba miguel-a-calles-mba requested review from a team May 13, 2020 14:28
const entry = getEntryForFunction.call(this, functions[index], this.serverless.service.getFunction(func));
_.merge(entries, entry);
const functionDef = this.serverless.service.getFunction(func);
if (_.startsWith(functionDef.runtime, 'node')) {

Choose a reason for hiding this comment

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

What happens when the global runtime is node and the runtime is not specified per function?

@miguel-a-calles-mba miguel-a-calles-mba changed the base branch from master to release/5.3.3 May 13, 2020 14:32
@miguel-a-calles-mba miguel-a-calles-mba requested a review from a team June 2, 2020 02:12
@j0k3r j0k3r mentioned this pull request Jun 12, 2020
7 tasks
miguel-a-calles-mba added a commit to smil2k/serverless-webpack that referenced this pull request Jun 13, 2020
From: Add support for multiple runtimes in service serverless-heaven#530
@miguel-a-calles-mba
Copy link
Member

Closing. Will use this PR instead: Check for node runtimes first #579.

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.

None yet

4 participants