-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Cannot deploy selected functions #82
Comments
I hit this same issue and wrote up a bunch of details as I chased down what was going on over here: serverless/serverless#6752 It looks like there are two ways to potentially fix this - though it might be best to apply a fix here and in serverless since the issue in serverless might cause other similar failures in any case where a user or plugin sets an absolute path for a package artifact. In //
// The AWS "provided" lambda runtime requires executables to be named
// "bootstrap" -- https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html
//
// To avoid artifact naming conflicts when we potentially have more than one function
// we leverage the ability to declare a package artifact directly
// see https://serverless.com/framework/docs/providers/aws/guide/packaging/
// for more information
const artifactPath = path.join(
this.srcPath,
`target/lambda/${"dev" === profile ? "debug" : "release"}`,
`${binary}.zip`
);
console.log("AP: " + artifactPath); // DEBUG
func.package = func.package || {};
func.package.artifact = artifactPath; which I think would ideally set a relative artifactPath instead of an absolute path. The basic issue here is that serverless is later on assuming a relative artifact path and joins it to the service path. Specifically in serverless, in packageFunction(functionName) {
const functionObject = this.serverless.service.getFunction(functionName);
const funcPackageConfig = functionObject.package || {};
// use the artifact in function config if provided
if (funcPackageConfig.artifact) {
const filePath = path.join(this.serverless.config.servicePath, funcPackageConfig.artifact);
console.log("filePath: join(" + this.serverless.config.servicePath + "," + funcPackageConfig.artifact + ")" ); // DEBUG
functionObject.package.artifact = filePath;
return BbPromise.resolve(filePath);
} which joins the above absolute path with the servicePath leading to this issue. I found that this modification fixed the issue for me: // use the artifact in function config if provided
if (funcPackageConfig.artifact) {
const filePath = path.isAbsolute(funcPackageConfig.artifact) ?
funcPackageConfig.artifact :
path.join(this.serverless.config.servicePath, funcPackageConfig.artifact);
console.log("filePath: join(" + this.serverless.config.servicePath + "," + funcPackageConfig.artifact + ")" );
functionObject.package.artifact = filePath;
return BbPromise.resolve(filePath);
} |
From the pov of the serverless framework it sounds like they see this as a serverless-rust plugin bug and it wasn't intended to be possible to set absolute artifact paths. (serverless/serverless#8315 (review)) |
🐛 Bug description
Cannot deploy selected functions from sls configuration.
🤔 Expected Behavior
Deploying selected functions
👟 Steps to reproduce
result into error:
There is duplicated file path.
🌍 Your environment
Operating System: win32
Node Version: 12.18.3
Framework Version: 1.78.1
Plugin Version: 3.7.0
SDK Version: 2.3.1
Components Version: 2.34.3
rust-plugin version: 0.3.8
The text was updated successfully, but these errors were encountered: