-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Cannot read property 'code' of undefined #12
Comments
I had the same issue. Try apply formats to the instance: const Ajv = require('ajv').default;
const AjvFormats = require('ajv-formats');
const ajv = new Ajv();
AjvFormats(ajv);
const validateSchema = ajv.compile(schema); |
I am having the same issue, throws error on last line.
error => Cannot read property 'code' of undefined
ajv object;
Not sue if any of this helps find / fix the issue but I hope so! |
Ran into the same issue. Make sure to install v7. For some reason Fixed with:
|
Thanks, got sorted via gitter post. |
I'm having the same issue with Ajv 8 running on top of Fastify's latest version. Any fixes related to this? |
It has to be submitted to fastify too. Maybe, the solution is to expose ajv instance in fastify and/or to pass options... |
I've sent a pull request to bump the dependencies, but it seems that the repo is unmaintained atm. |
Same issue in latest AJV and formats - broken for me. Any hope in getting this fixed? We're basing a very large project on AJV and this really concerning. It breaks every time I update packages. |
I’m not 100% sure what is the right fix here. If that’s the case it’s more of annoying npm “feature” rather than the bug to be fixed in ajv… I am open to ideas what’s the correct mitigation would be here. |
its working thanks |
Same problem here, with ajv version 8.x After some frustrated attemps, removing everything ajv-related and installing again worked. That is npm rm -w our/tool ajv ajv-errors ajv-formats
npm install -w our/tool ajv ajv-errors ajv-formats Hope it helps. Very strange 🤔 |
After upgrading other non-related deps, got the same problem. My proposed workaround did not work. I suspect the problem arises from |
Not really seeing a fix or workaround above? I'm trying to migrate to ES6, ajv 8.12.0. Only adding one parameter to addFormats. import Ajv2020 from "../../../node_modules/ajv/dist/2020.js"; const ajv = Ajv2020; |
I'm using @middy/validator for which I add the plugin with an empty object
{}
.Unfortunately I get an error:
TypeError: Cannot read property 'code' of undefined
Pointing to line https://github.com/ajv-validator/ajv-formats/blob/master/src/index.ts#L55
Please help!
The text was updated successfully, but these errors were encountered: