question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected non-function AJV validator type

See original GitHub issue

Are you certain it’s a bug?

  • Yes, it looks like a bug

Is the issue caused by a plugin?

  • It is not a plugin issue

Are you using the latest version?

  • Yes, I’m using the latest version

Is there an existing issue for this?

  • I have searched existing issues, it hasn’t been reported yet

Issue description

Serverless deployment is failing occasionally, this has been happening since updating to version 3.

Service configuration (serverless.yml) content

service: service-name
projectDir: ../../

plugins:
  - serverless-s3-sync

custom:
  bucketName: name-${env:STAGE}
  s3Sync:
    - bucketName: ${self:custom.bucketName}
      bucketPrefix: ${env:PR_NUMBER}
      localDir: dist

provider:
  name: aws
  runtime: nodejs12.x
  stage: ${env:STAGE}

resources:
  Resources:
    StaticSite:
      Type: AWS::S3::Bucket
      Properties:
        BucketName: ${self:custom.bucketName}
        CorsConfiguration:
          CorsRules:
            - AllowedHeaders:
                - '*'
              AllowedMethods:
                - GET
              AllowedOrigins:
                - 'https://*.${env:DOMAIN}'

    StaticSiteS3BucketPolicy:
      Type: AWS::S3::BucketPolicy
      Properties:
        Bucket:
          Ref: StaticSite
        PolicyDocument:
          Statement:
            - Effect: Allow
              Action:
                - s3:GetObject
              Resource: !Sub '${StaticSite.Arn}/*'
              Principal:
                CanonicalUser: ${cf:apps-${env:STAGE}.S3CanonicalUserId}

Command name and used flags

sls deploy --verbose

Command output

× Unexpected validator {}, resolved from source 
Environment: linux, node 16.13.2, framework 3.2.0 (local), plugin 6.0.0, SDK 4.3.1
Credentials: Local, environment variables
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: Unexpected non-function AJV validator type. Please report at https://github.com/serverless/serverless including all the logs output
    at getValidate (/home/runner/work/apps/apps/node_modules/.pnpm/serverless@3.2.0/node_modules/serverless/lib/classes/config-schema-handler/resolve-ajv-validate.js:73:11)
    at async ConfigSchemaHandler.validateConfig (/home/runner/work/apps/apps/node_modules/.pnpm/serverless@3.2.0/node_modules/serverless/lib/classes/config-schema-handler/index.js:98:22)
    at async Service.validate (/home/runner/work/apps/apps/node_modules/.pnpm/serverless@3.2.0/node_modules/serverless/lib/classes/service.js:267:5)
    at async Serverless.run (/home/runner/work/apps/apps/node_modules/.pnpm/serverless@3.2.0/node_modules/serverless/lib/serverless.js:162:28)
    at async /home/runner/work/apps/apps/node_modules/.pnpm/serverless@3.2.0/node_modules/serverless/scripts/serverless.js:686:9
undefined

Environment information

Framework Core: 3.2.0 (local)
Plugin: 6.0.0
SDK: 4.3.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pgrzesikcommented, Feb 16, 2022

I’m going to close this one as it’s supposed to be solved with 3.2.1

1reaction
pgrzesikcommented, Feb 15, 2022

Sorry you’ve run into trouble @adrianaferrugento - could you please open a separate task for this? It seems to be an unrelated error, thanks in advance 🙇

Read more comments on GitHub >

github_iconTop Results From Across the Web

Strict mode - Ajv JSON schema validator
Strict mode intends to prevent any unexpected behaviours or silently ignored mistakes in user schemas. ... JSON Type Definition schemas; JSON Schema schemas....
Read more >
AJV doesn't validate my body with the function returned by ...
The function returned by compile has different parameters than ajv.validate and no need de specify the schema.
Read more >
Manifest File - Texas Instruments
Software Name, Version, License Type, Delivered As, Modified by TI ... Obtained from, https://github.com/ajv-validator/ajv-formats ...
Read more >
FAA Order JO 7210.3AA with CHG 1 and CHG 2 - Federal Aviation ...
Part 1 contains information generally applicable to two or more types of facilities. ... AIR TRAFFIC SERVICE DURING PLANNED AND UNPLANNED OUTAGES. 2−1−3....
Read more >
Ajv: Another JSON schema validator - npm
TypeScript icon, indicating that this package has built-in type ... to reduce the mistakes in JSON schemas and unexpected validation results ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found