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

Don't package non-node functions (fix for #644) #663

Merged
merged 2 commits into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ module.exports = {
if (_.has(this.serverless, 'service.package') && this.serverless.service.package.individually) {
this.multiCompile = true;
this.serializedCompile = this.configuration.serializedCompile;
this.options.verbose && this.serverless.cli.log(`Using ${this.serializedCompile ? 'serialized' : 'multi'}-compile (individual packaging)`);
this.options.verbose &&
this.serverless.cli.log(
`Using ${this.serializedCompile ? 'serialized' : 'multi'}-compile (individual packaging)`
);
j0k3r marked this conversation as resolved.
Show resolved Hide resolved

if (this.webpackConfig.entry && !_.isEqual(this.webpackConfig.entry, entries)) {
return BbPromise.reject(
Expand All @@ -203,16 +206,23 @@ module.exports = {
}

// Lookup associated Serverless functions
const allEntryFunctions = _.map(this.serverless.service.getAllFunctions(), funcName => {
const func = this.serverless.service.getFunction(funcName);
const handler = func.handler;
const handlerFile = path.relative('.', getHandlerFile(handler));
return {
handlerFile,
funcName,
func
};
});
const allEntryFunctions = _.map(
_.filter(this.serverless.service.getAllFunctions(), funcName => {
const func = this.serverless.service.getFunction(funcName);
const runtime = func.runtime || this.serverless.service.provider.runtime || 'nodejs';
return runtime.match(/node/);
}),
funcName => {
const func = this.serverless.service.getFunction(funcName);
const handler = func.handler;
const handlerFile = path.relative('.', getHandlerFile(handler));
return {
handlerFile,
funcName,
func
};
}
);

this.entryFunctions = _.flatMap(entries, (value, key) => {
const entry = path.relative('.', value);
Expand Down
14 changes: 13 additions & 1 deletion tests/validate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,18 @@ describe('validate', () => {
}
],
runtime: 'java8'
},
rustfunc: {
handler: 'my-rust-func',
runtime: 'rust',
events: [
{
http: {
method: 'POST',
path: 'rustfuncpath'
}
}
]
}
};

Expand Down Expand Up @@ -960,7 +972,7 @@ describe('validate', () => {
});

describe('with skipped builds', () => {
it('should set `skipComile` to true if `options.build` is false', () => {
it('should set `skipCompile` to true if `options.build` is false', () => {
const testConfig = {
entry: 'test',
output: {}
Expand Down