e TypeError: Cannot read properties of undefined (reading 'charAt')
at next (/Users/joserego/Documents/lightdash/node_modules/@humanwhocodes/momoa/api.js:235:22)
at tokenize (/Users/joserego/Documents/lightdash/node_modules/@humanwhocodes/momoa/api.js:491:13)
at parse (/Users/joserego/Documents/lightdash/node_modules/@humanwhocodes/momoa/api.js:726:20)
at Object.src_default (/Users/joserego/Documents/lightdash/packages/cli/node_modules/better-ajv-errors/lib/cjs/index.js:31:42)
at /Users/joserego/Documents/lightdash/packages/cli/dist/dbt/schema.js:55:49
at Generator.next (<anonymous>)
at fulfilled (/Users/joserego/Documents/lightdash/packages/cli/dist/dbt/schema.js:24:58)
Workaround
By making sure the data defaults to an empty string or an empty object or null.
Our code:
Values:
schemaFile is
undefined
validate.errors is
Error:
Workaround
By making sure the data defaults to an empty string or an empty object or null.
And with this get the proper error:
Solution:
better-ajv-errors
could make suredata
can't be undefined. Or support undefined and have an appropriate message.