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

fastify v3 requires using ajv v6 and ajv-keywords v3 #164

Open
matt212 opened this issue Mar 30, 2021 · 5 comments
Open

fastify v3 requires using ajv v6 and ajv-keywords v3 #164

matt212 opened this issue Mar 30, 2021 · 5 comments

Comments

@matt212
Copy link

matt212 commented Mar 30, 2021

Hi
Below is Details ,

Node version : v14.16.0
Npm version: 7.7.6
Dependencies Details
"ajv": "^8.0.1", "ajv-keywords": "^5.0.0",

Code Snippet

const fastify = require("fastify")({
   ajv: {
    plugins: [[require("ajv-keywords"), ["transform"]]],
  },
});

stack trace Error

image

Help here would great !

matt212 added a commit to matt212/Nodejs_Postgresql_VanillaJS_Fastify that referenced this issue Mar 30, 2021
@Eomm
Copy link

Eomm commented Mar 30, 2021

Fastify v3 does not support ajv 8 out of the box

You need to configure your server with ajv6 compatibility plugins, or follow this pr
fastify/fastify#2862

Or customizer the validator compiler by yourself

@matt212
Copy link
Author

matt212 commented Mar 31, 2021

Hi @Eomm ,
I downgraded to "ajv-keywords": "^3.5.2", and removed "ajv": "^8.0.1", altogether and error seems to go away.
However it would better to keep this issue open until the dependency with fastify 3 is resolved

matt212 added a commit to matt212/Nodejs_Postgresql_VanillaJS_Fastify that referenced this issue Mar 31, 2021
@epoberezkin
Copy link
Member

@Eomm thank you - I was thinking it is probably this issue.

let me know if you need any advice on migrating to v8 in fastify v4.

@epoberezkin epoberezkin changed the title Keyword [object Object] is not a valid identifier fastify v3 requires using ajv v6 and ajv-keywords v3 Mar 31, 2021
@devlzcode
Copy link

@Eomm thank you - I was thinking it is probably this issue.

let me know if you need any advice on migrating to v8 in fastify v4.

I'd like to know how we'd migrate to v8 in fastify v4

@Eomm
Copy link

Eomm commented Apr 22, 2021

We don't have a release date for fastify v4 yet, but for sure it will support ajv 8 by default 👍🏼

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

No branches or pull requests

4 participants