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

Configuration warning: unrecognized property 'module' #8423

Closed
luislhl opened this issue Oct 21, 2020 · 5 comments
Closed

Configuration warning: unrecognized property 'module' #8423

luislhl opened this issue Oct 21, 2020 · 5 comments

Comments

@luislhl
Copy link
Contributor

luislhl commented Oct 21, 2020

I'm getting this warning during deploys when trying to use the functions module option, since version 2.7.0.
The same thing works with 2.6.0

serverless.yml
service: boilerplate-lambda

provider:
  name: aws
  runtime: python3.7
  stage: dev

package:
  individually: true

functions:
  lambda-1:
    module: lambda1 
    handler: src/main.main

  lambda-2:
    module: lambda2
    handler: src/main.main

plugins:
  - serverless-python-requirements
serverless deploy output
Serverless: Configuration warning:
Serverless:   at 'functions['lambda-1']': unrecognized property 'module'
Serverless:   at 'functions['lambda-2']': unrecognized property 'module'
Serverless:  
Serverless: Learn more about configuration validation here: http://slss.io/configuration-validation

Installed version

Framework Core: 2.7.0
Plugin: 4.1.1
SDK: 2.3.2
Components: 3.2.4
@luislhl
Copy link
Contributor Author

luislhl commented Oct 21, 2020

I'm not sure if this was the cause, but this commit seems to have changed something related to this validation: 719fa3a

@fredericbarthelet
Copy link
Contributor

fredericbarthelet commented Oct 25, 2020

Hi @luislhl , thanks for reporting your issue.

The commit you reference did in fact remove validation relaxation on function definitions.
You can see the full schema used for validation in

function: {
properties: {
awsKmsKeyArn: { $ref: '#/definitions/awsKmsArn' },
condition: { $ref: '#/definitions/awsResourceCondition' },
dependsOn: { $ref: '#/definitions/awsResourceDependsOn' },
description: { type: 'string', maxLength: 256 },
destinations: {
type: 'object',
properties: {
onSuccess: { type: 'string', minLength: 1 },
onFailure: { type: 'string', minLength: 1 },
},
additionalProperties: false,
},
disableLogs: { type: 'boolean' },
environment: { $ref: '#/definitions/awsLambdaEnvironment' },
fileSystemConfig: {
type: 'object',
properties: {
arn: {
anyOf: [
{
type: 'string',
pattern:
'^arn:aws[a-zA-Z-]*:elasticfilesystem:[a-z]{2}((-gov)|(-iso(b?)))?-[a-z]+-[1-9]{1}:[0-9]{12}:access-point/fsap-[a-f0-9]{17}$',
},
{ $ref: '#/definitions/awsCfGetAtt' },
{ $ref: '#/definitions/awsCfJoin' },
{ $ref: '#/definitions/awsCfImport' },
],
},
localMountPath: { type: 'string', pattern: '^/mnt/[a-zA-Z0-9-_.]+$' },
},
additionalProperties: false,
required: ['localMountPath', 'arn'],
},
handler: { type: 'string' },
kmsKeyArn: { $ref: '#/definitions/awsKmsArn' },
layers: { $ref: '#/definitions/awsLambdaLayers' },
maximumEventAge: { type: 'integer', minimum: 60, maximum: 21600 },
maximumRetryAttempts: { type: 'integer', minimum: 0, maximum: 2 },
memorySize: { $ref: '#/definitions/awsLambdaMemorySize' },
onError: {
anyOf: [
{ type: 'string', pattern: '^arn:aws[a-z-]*:sns' },
{ $ref: '#/definitions/awsCfFunction' },
],
},
package: {
type: 'object',
properties: {
artifact: { type: 'string' },
exclude: { type: 'array', items: { type: 'string' } },
include: { type: 'array', items: { type: 'string' } },
individually: { type: 'boolean' },
},
additionalProperties: false,
},
provisionedConcurrency: { type: 'integer', minimum: 1 },
reservedConcurrency: { type: 'integer', minimum: 0 },
role: { $ref: '#/definitions/awsLambdaRole' },
runtime: { $ref: '#/definitions/awsLambdaRuntime' },
tags: { $ref: '#/definitions/awsResourceTags' },
timeout: { $ref: '#/definitions/awsLambdaTimeout' },
tracing: { $ref: '#/definitions/awsLambdaTracing' },
versionFunction: { $ref: '#/definitions/awsLambdaVersionning' },
vpc: { $ref: '#/definitions/awsLambdaVpcConfig' },
},
additionalProperties: false,
},

The module property is not defined as a valid function property.
I don't see any reference of this property within the Serverless documentation.

I see the use of serverless-python-requirements plugin in your exemple file. Plugin developers should add definition for properties used by their plugin within their code base following https://www.serverless.com/framework/docs/providers/aws/guide/plugins/#extending-validation-schema documentation.

As of today, you can add in serverless.yaml root configValidationMode: off and it will disable display of those error messages. You however won't benefit from JSON schema validation for other properties of your service file.

@medikoo do you think, similarly to #8438, that an additional method defineFunctionProperties should be implemented ? The idea would be to allow serverless-python-requirements plugin to enrich function common schema with their module property schema.

@luislhl
Copy link
Contributor Author

luislhl commented Oct 27, 2020

Thanks for your reponse, @fredericbarthelet

I don't see any reference of this property within the Serverless documentation.

Indeed, I didn't find it either. It only exists in the serverless-python-requirements plugin docs: https://www.serverless.com/plugins/serverless-python-requirements

But it is now clearer to me what happened for this to break and that this is a custom field used only by the plugin.

I'll think about the best option for me. Feel free to close the issue if you need to.

@medikoo
Copy link
Contributor

medikoo commented Oct 28, 2020

This issue is about same issue as we discuss at #8422, I'm going to close it, and let's follow discussion over there.

@medikoo
Copy link
Contributor

medikoo commented Oct 28, 2020

Duplicate of #8422

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants