atlassian / atlassian/better-ajv-errors
Error when use in angular 16
- Dominant language
- JavaScript
- Stars
- 245
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Description
I have this error in console when in an angular service:
`ERROR Error: Uncaught (in promise): ReferenceError: process is not defined`
this is the code
```
import { Injectable } from '@angular/core';
import Ajv, { ErrorObject } from 'ajv';
import betterAjvErrors from 'better-ajv-errors';
import { geoJsonSchema } from './geojson.schema'; // the json schema
@Injectable({
providedIn: 'root',
})
export class GeojsonValidationService {
private ajv: Ajv;
constructor() {
this.ajv = new Ajv();
}
validateJson(data: any, schema: object = geoJsonSchema): boolean {
const validate = this.ajv.compile(schema);
const valid = validate(data);
if (!valid) {
const errors: ErrorObject[] = validate.errors || [];
const output = betterAjvErrors(schema, data, errors);
console.log('output => ', output);
}
return valid;
}
```
the versions that i use are:
```
"@angular/core": "^16.2.12",
[...]
"ajv": "^8.12.0",
"better-ajv-errors": "^1.2.0",
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the reported process-is-not-defined error from the Angular service example using Angular 16, ajv, and better-ajv-errors. Trace the browser bundle entry point and the imported geojson.schema until the source of the process reference is identified; done means validation works without this console error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100