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

Warning: unrecognized property 'reqValidatorName' #21

Closed
jcandrade opened this issue Jan 21, 2021 · 10 comments
Closed

Warning: unrecognized property 'reqValidatorName' #21

jcandrade opened this issue Jan 21, 2021 · 10 comments
Labels

Comments

@jcandrade
Copy link

After updating the framework to version 2.19.0, it's throwing this warning on deploy:

Serverless: Configuration warning:
Serverless:   at 'functions.XXX.events[0].http': unrecognized property 'reqValidatorName'

Here's my plugin serverless.yml:

functions:
  XXX:
    handler: src/XXX.xxx
    events:
      - http:
          path: /api/XXX
          method: get
          reqValidatorName: onlyParamsValidator
          request:
            parameters:
              headers:
                'Header-X': true
                
resources:
  Resources:
    onlyParamsValidator:
      Type: AWS::ApiGateway::RequestValidator
      Properties:
        Name: 'Validate query params and headers'
        RestApiId:
          Ref: ApiGatewayRestApi
        ValidateRequestBody: false
        ValidateRequestParameters: true
@RafPe
Copy link
Owner

RafPe commented Jan 21, 2021

Hi @jcandrade - can you paste the whole of your serverless config ( or at least the parts when you reference required plugins ? )

@israelmelicio
Copy link

I have the same problem

@RafPe
Copy link
Owner

RafPe commented Jan 21, 2021

I really need more details to work here. What is the SLS version installed ?

Please paste the server less.yaml

@jcandrade
Copy link
Author

jcandrade commented Jan 21, 2021

@RafPe I shared a short version of my serverless.yml, but here are a few more lines:

Version:

➜  ~ sls -v
Framework Core: 2.19.0
Plugin: 4.4.2
SDK: 2.3.2
Components: 3.5.0

serverless.yml

service: lambdas

plugins:
  - serverless-plugin-typescript
  - serverless-reqvalidator-plugin
  - serverless-aws-documentation

custom:
  customDomain:
    domainName: xxx.com
    basePath: ''
    stage: ${self:provider.stage}
    createRoute53Record: true

provider:
  name: aws
  runtime: nodejs12.x
  stage: ${opt:stage}
  tracing:
    apiGateway: true
    lambda: true
  logRetentionInDays: 14
  lambdaHashingVersion: 20201221
  apiName: ${opt:stage, self:provider.stage}

package:
  individually: true

functions:
  XXX:
    name: ${self:provider.stage}-xxx
    handler: src/XXX.xxx
    events:
      - http:
          path: /api/xxx
          method: get
          cors:
            origin: '*'
            headers:
              - '*'
          reqValidatorName: onlyParamsValidator
          request:
            parameters:
              headers:
                'Authorization': true

resources:
  Resources:
    onlyParamsValidator:
      Type: AWS::ApiGateway::RequestValidator
      Properties:
        Name: 'Validate query params and headers'
        RestApiId:
          Ref: ApiGatewayRestApi
        ValidateRequestBody: false
        ValidateRequestParameters: true
        

@RafPe
Copy link
Owner

RafPe commented Jan 21, 2021

@jcandrade Did not experience any problems you are describing when running the stack

❯ serverless --version
Framework Core: 2.19.0
Plugin: 4.4.2
SDK: 2.3.2
Components: 3.4.7

I have also strip down a bit of your yaml to deploy on my end

service: test-gh-issue

plugins:
  - serverless-reqvalidator-plugin
  - serverless-aws-documentation

provider:
  name: aws
  runtime: nodejs12.x
  stage: test
  region: eu-central-1

functions:
  test:
    name: test-xxx
    handler: src/handler.js
    events:
      - http:
          path: /api/xxx
          method: get
          cors:
            origin: '*'
            headers:
              - '*'
          reqValidatorName: onlyParamsValidator

package:
  include:
    - ./src

resources:
  Resources:
    onlyParamsValidator:
      Type: AWS::ApiGateway::RequestValidator
      Properties:
        Name: 'Validate query params and headers'
        RestApiId:
          Ref: ApiGatewayRestApi
        ValidateRequestBody: false
        ValidateRequestParameters: true

@RafPe
Copy link
Owner

RafPe commented Jan 21, 2021

Also warnings but not the ones you mentioned

❯ serverless deploy --aws-profile test-gh
Serverless: Deprecation warning: Starting with next major version, default value of provider.lambdaHashingVersion will be equal to "20201221"
            More Info: https://www.serverless.com/framework/docs/deprecations/#LAMBDA_HASHING_VERSION_V2
Serverless: Deprecation warning: Starting with next major version, API Gateway naming will be changed from "{stage}-{service}" to "{service}-{stage}".
            Set "provider.apiGateway.shouldStartNameWithService" to "true" to adapt to the new behavior now.
            More Info: https://www.serverless.com/framework/docs/deprecations/#AWS_API_GATEWAY_NAME_STARTING_WITH_SERVICE
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service test-gh-issue.zip file to S3 (6.88 KB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...

@jcandrade
Copy link
Author

hey @RafPe , I'm still having the same issue on the latest sls version. I just tested on 2.33.0. There are more warnings/errors, but I'm only concerned about the Configuration warning at 'functions.test.events[0].http': unrecognized property 'reqValidatorName' error. These are the results after running the serverless.yml that you shared:

serverless git:(develop) ✗ sls --stage dev
Serverless: Deprecation warning: CLI options definitions were upgraded with "type" property (which could be one of "string", "boolean", "multiple"). Below listed plugins do not predefine type for introduced options:
             - ServerlessAWSDocumentation for "outputFileName"
            Please report this issue in plugin issue tracker.
            Starting with next major release, this will be communicated with a thrown error.
            More Info: https://www.serverless.com/framework/docs/deprecations/#CLI_OPTIONS_SCHEMA
Serverless: Configuration warning at 'functions.test.events[0].http': unrecognized property 'reqValidatorName'
Serverless:  
Serverless: Learn more about configuration validation here: http://slss.io/configuration-validation
Serverless:  
Serverless: Deprecation warning: Starting with next major, Serverless will throw on configuration errors by default. Adapt to this behavior now by adding "configValidationMode: error" to service configuration
            More Info: https://www.serverless.com/framework/docs/deprecations/#CONFIG_VALIDATION_MODE_DEFAULT
Serverless: Deprecation warning: Support for "package.include" and "package.exclude" will be removed with next major release. Please use "package.patterns" instead
            More Info: https://www.serverless.com/framework/docs/deprecations/#NEW_PACKAGE_PATTERNS
Serverless: Deprecation warning: Resolution of lambda version hashes was improved with better algorithm, which will be used in next major release.
            Switch to it now by setting "provider.lambdaHashingVersion" to "20201221"
            More Info: https://www.serverless.com/framework/docs/deprecations/#LAMBDA_HASHING_VERSION_V2
➜  serverless git:(develop) ✗ sls --version  
Framework Core: 2.33.0
Plugin: 4.5.3
SDK: 4.2.2
Components: 3.8.1

@shubsaini09
Copy link

shubsaini09 commented Jul 6, 2021

@RafPe could this be related to Serverless-8438? I am also facing similar issue.

image

"serverless": "^2.50.0", "serverless-aws-documentation": "^1.1.0", "serverless-reqvalidator-plugin": "^1.0.3"

@RafPe
Copy link
Owner

RafPe commented Jul 6, 2021

@shubsaini09 Plugin already defines required schema definitions here.

@fayyozbobokulov
Copy link

The same error is coming even in serverless.ts. Is there any ways to solve it?

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

No branches or pull requests

5 participants