softprops / serverless-rust

⚡ 🦀 a serverless framework plugin for rustlang applications
https://www.npmjs.com/package/serverless-rust
MIT License
541 stars 81 forks source link

Configuration warning with serverless 2.3.0 #87

Open dbanty opened 3 years ago

dbanty commented 3 years ago

🐛 Bug description

After updating Serverless from 2.0.0 to 2.3.0, I started receiving this warning: Configuration warning at 'provider.runtime': should be equal to one of the allowed values [dotnetcore2.1, dotnetcore3.1, go1.x, java11, java8, java8.al2, nodejs10.x, nodejs12.x, provided, provided.al2, python2.7, python3.6, python3.7, python3.8, ruby2.5, ruby2.7].

🤔 Expected Behavior

There would be no warnings from serverless when using the example config for this plugin.

👟 Steps to reproduce

Use provider.runtime = rust in your serverless.yml with the latest Serverless.

🌍 Your environment

serverless version: 2.3.0 rust-plugin version: 0.3.8

atridgedcosta commented 3 years ago

Here is a reference to the issue https://www.serverless.com/framework/docs/configuration-validation/

In my case, everything still deployed and worked as expected.

mosen commented 3 years ago

I did add some config validation on my fork, but although configSchemaHandler does do some limited merging via Object.assign(), it does not merge the enum prop of definitions.awsLambdaRuntime.enum which would be required to make rust a valid option?

I did successfully add validation for the custom.rust section though.

softprops commented 3 years ago

Interesting. This plugin relied on the previous flexibility of the config file to deterministically know which functions targeted rust and which don’t through the runtime setting.

In processing a command it gets wired back to the provided runtime so serverless cli does the right thing for its internal tasks

one option might be the option mentioned in the link you posted and setting the validation mode off

configValidationMode: off

Since that’s not a default that can be cumbersome. The tradeoff there is there are other things config validation affords you. If there weren’t it wouldn’t be on by default

im open to other options

mosen commented 3 years ago

Maybe I'll suggest to whomever is looking at the serverless AWS provider that they standardise their own extension of available runtimes. It doesn't make sense to have the json schema altered for every additional custom runtime.