cockroachdb / sequelize-cockroachdb

Use Sequelize and CockroachDB together
Apache License 2.0
53 stars 16 forks source link

Schema "crdb_internal" does not exist #138

Closed atjhoendz closed 2 years ago

atjhoendz commented 2 years ago

Previously I used sequelize with dialect postgres, and I try to move to cockroachdb using this library with the same model, overall CRUD process is working but the logger says:

Could not record telemetry.
SequelizeDatabaseError: schema "crdb_internal" does not exist.

this is my crdb_internal schema that already exists.

Screen Shot 2021-12-15 at 15 13 01

I already force sync but the error log still exists

any thoughts on this?

rafiss commented 2 years ago

The error message referring to the call to this builtin function (used to let CRDB know that the tool being used is sequelize). https://github.com/cockroachdb/sequelize-cockroachdb/blob/a0ae8eab1c51baef1dc968a223685c4daa02a422/source/telemetry.js#L22

The error is not expected though. Which version of CockroachDB are you using?

atjhoendz commented 2 years ago

I using v21.2.2 with docker

atjhoendz commented 2 years ago

I think I know the problem, this line should have an await statement because this condition is a promise. I'll make PR for the solution

https://github.com/cockroachdb/sequelize-cockroachdb/blob/a0ae8eab1c51baef1dc968a223685c4daa02a422/source/telemetry.js#L16

atjhoendz commented 2 years ago

please kindly review sir https://github.com/cockroachdb/sequelize-cockroachdb/pull/139 @rafiss

TIA.

rafiss commented 2 years ago

Thanks for your fix. I've merged it and will publish a new release soon. However, I'm still not sure why you would have this error on CockroachDB v21.2.2. Are you sure you are not using an older version of CockroachDB?

atjhoendz commented 2 years ago

I don't know sir. Yes, I'm pretty sure, this is part of my docker-compose config. After I fixed that promise condition, the error log has been disappeared now.

Screen Shot 2021-12-17 at 13 08 55

rafiss commented 2 years ago

Hm, ok glad it's working better now! Perhaps there is some race condition. Thanks again for noticing this and fixing it.

atjhoendz commented 2 years ago

My pleasure 👌