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

Errors are very minimalistic and hard to debug with #123

Open
MattGson opened this issue May 27, 2021 · 3 comments · May be fixed by #122
Open

Errors are very minimalistic and hard to debug with #123

MattGson opened this issue May 27, 2021 · 3 comments · May be fixed by #122

Comments

@MattGson
Copy link

Many errors logged/thrown have very minimalistic messages which often hide the problem.

I have found myself having to debug by adding logs into the schema registry code which is not ideal.

Ideally, the logs would provide full traces where possible and contextual information which is unambiguous.

@kevinrlewis
Copy link

I would like to add to this, currently getting invalid payload with paths: [ [ '' ] ] which I'm struggling to interpret. The payload and schema are validated using other tools so I'm drawing a blank on what my issue is.

@kevinrlewis
Copy link

Going to add my current workaround, logging the err on this line

for (const err of this.validate.errors as AjvValidationError[]) {
helped me plenty.

@pwmcintyre
Copy link

FWIW - i found myself re-validating via Ajv if the registry returns an error (which should be unnecessary!)

related: #236

example

      // encode
      return registry.encode(valueSchemaID, row)
          .catch( (error) => {
              // validate
              // https://ajv.js.org/guide/getting-started.html
              // NOTE:
              // It might seem strange that we validate here, since
              // the schema registry should have already done this ... but the schema registry
              // doesn't return the actual error, just a generic message.
              // 
              // Additionally: there's a bug where you can't specify the AJV instance for the registry
              // to use, so we can't harvest the error from their either.
              // Bug: https://github.com/kafkajs/confluent-schema-registry/issues/236
              const valid = this.avj.validate(this.options.schema, row)
              if ( !valid ) {
                  StandardLogger.warn('validation errors', { context, key, errors: this.avj.errors })
              }

          })

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